Skip to content

Commit

Permalink
Merge pull request #417 from erikerskine/master
Browse files Browse the repository at this point in the history
Add PHP 8.1 return types to the Response class
  • Loading branch information
ksvirkou-hubspot authored Feb 6, 2024
2 parents 3918e2f + ef7e73e commit 49448cf
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions src/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace SevenShores\Hubspot\Http;

use ArrayAccess;
use Psr\Http\Message\MessageInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;

Expand Down Expand Up @@ -106,7 +107,7 @@ public function offsetUnset($offset): void
*
* @return string HTTP protocol version
*/
public function getProtocolVersion()
public function getProtocolVersion(): string
{
return $this->response->getProtocolVersion();
}
Expand All @@ -125,7 +126,7 @@ public function getProtocolVersion()
*
* @return self
*/
public function withProtocolVersion($version)
public function withProtocolVersion($version): MessageInterface
{
return $this->response->withProtocolVersion($version);
}
Expand Down Expand Up @@ -155,7 +156,7 @@ public function withProtocolVersion($version)
* key MUST be a header name, and each value MUST be an array of strings
* for that header.
*/
public function getHeaders()
public function getHeaders(): array
{
return $this->response->getHeaders();
}
Expand All @@ -169,7 +170,7 @@ public function getHeaders()
* name using a case-insensitive string comparison. Returns false if
* no matching header name is found in the message.
*/
public function hasHeader($name)
public function hasHeader($name): bool
{
return $this->response->hasHeader($name);
}
Expand All @@ -189,7 +190,7 @@ public function hasHeader($name)
* header. If the header does not appear in the message, this method MUST
* return an empty array.
*/
public function getHeader($name)
public function getHeader($name): array
{
return $this->response->getHeader($name);
}
Expand All @@ -214,7 +215,7 @@ public function getHeader($name)
* concatenated together using a comma. If the header does not appear in
* the message, this method MUST return an empty string.
*/
public function getHeaderLine($name)
public function getHeaderLine($name): string
{
return $this->response->getHeaderLine($name);
}
Expand All @@ -236,7 +237,7 @@ public function getHeaderLine($name)
*
* @return self
*/
public function withHeader($name, $value)
public function withHeader($name, $value): MessageInterface
{
return $this->response->withHeader($name, $value);
}
Expand All @@ -259,7 +260,7 @@ public function withHeader($name, $value)
*
* @return self
*/
public function withAddedHeader($name, $value)
public function withAddedHeader($name, $value): MessageInterface
{
return $this->response->withAddedHeader($name, $value);
}
Expand All @@ -277,7 +278,7 @@ public function withAddedHeader($name, $value)
*
* @return self
*/
public function withoutHeader($name)
public function withoutHeader($name): MessageInterface
{
return $this->response->withoutHeader($name);
}
Expand All @@ -287,7 +288,7 @@ public function withoutHeader($name)
*
* @return StreamInterface returns the body as a stream
*/
public function getBody()
public function getBody(): StreamInterface
{
return $this->response->getBody();
}
Expand All @@ -307,7 +308,7 @@ public function getBody()
*
* @return self
*/
public function withBody(StreamInterface $body)
public function withBody(StreamInterface $body): MessageInterface
{
return $this->response->withBody($body);
}
Expand All @@ -320,7 +321,7 @@ public function withBody(StreamInterface $body)
*
* @return int status code
*/
public function getStatusCode()
public function getStatusCode(): int
{
return $this->response->getStatusCode();
}
Expand Down Expand Up @@ -348,7 +349,7 @@ public function getStatusCode()
*
* @return self
*/
public function withStatus($code, $reasonPhrase = '')
public function withStatus($code, $reasonPhrase = ''): ResponseInterface
{
return $this->response->withStatus($code, $reasonPhrase);
}
Expand All @@ -367,7 +368,7 @@ public function withStatus($code, $reasonPhrase = '')
*
* @return string reason phrase; must return an empty string if none present
*/
public function getReasonPhrase()
public function getReasonPhrase(): string
{
return $this->response->getReasonPhrase();
}
Expand Down

0 comments on commit 49448cf

Please sign in to comment.