Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add return types to MessageResponseTrait to match upcoming PSR interface #1251

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Response/Elasticsearch.php
Expand Up @@ -198,7 +198,7 @@ public function offsetExists($offset): bool
* @see https://www.php.net/manual/en/class.arrayaccess.php
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
public function offsetGet($offset): mixed
{
return $this->asArray()[$offset];
}
Expand Down
28 changes: 14 additions & 14 deletions src/Traits/MessageResponseTrait.php
Expand Up @@ -22,72 +22,72 @@
*/
trait MessageResponseTrait
{
public function getProtocolVersion()
public function getProtocolVersion(): string
{
return $this->response->getProtocolVersion();
}

public function withProtocolVersion($version)
public function withProtocolVersion($version): static
{
return $this->response->withProtocolVersion($version);
}

public function getHeaders()
public function getHeaders(): array
{
return $this->response->getHeaders();
}

public function hasHeader($name)
public function hasHeader($name): bool
{
return $this->response->hasHeader($name);
}

public function getHeader($name)
public function getHeader($name): array
{
return $this->response->getHeader($name);
}

public function getHeaderLine($name)
public function getHeaderLine($name): string
{
return $this->response->getHeaderLine($name);
}

public function withHeader($name, $value)
public function withHeader($name, $value): static
{
return $this->response->withHeader($name, $value);
}

public function withAddedHeader($name, $value)
public function withAddedHeader($name, $value): static
{
return $this->response->withAddedHeader($name, $value);
}

public function withoutHeader($name)
public function withoutHeader($name): static
{
return $this->response->withoutHeader($name);
}

public function getBody()
public function getBody(): StreamInterface
{
return $this->response->getBody();
}

public function withBody(StreamInterface $body)
public function withBody(StreamInterface $body): static
{
return $this->response->withBody($body);
}

public function getStatusCode()
public function getStatusCode(): int
{
return $this->response->getStatusCode();
}

public function withStatus($code, $reasonPhrase = '')
public function withStatus($code, $reasonPhrase = ''): static
{
return $this->response->withStatus($code, $reasonPhrase);
}

public function getReasonPhrase()
public function getReasonPhrase(): string
{
return $this->response->getReasonPhrase();
}
Expand Down