Skip to content

Commit

Permalink
Add phpdoc regarding return types (#710)
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Sep 22, 2022
1 parent 29fca7a commit 0971a49
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/Http/Psr7/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,25 @@ public function __construct(
$this->protocol = $version;
}

/**
* @return int
*/
public function getStatusCode()
{
return $this->statusCode;
}

/**
* @return string
*/
public function getReasonPhrase()
{
return $this->reasonPhrase;
}

/**
* @return static
*/
public function withStatus($code, $reasonPhrase = '')
{
$new = clone $this;
Expand All @@ -147,11 +156,17 @@ public function withStatus($code, $reasonPhrase = '')
return $new;
}

/**
* @return string
*/
public function getProtocolVersion()
{
return $this->protocol;
}

/**
* @return static
*/
public function withProtocolVersion($version)
{
if ($this->protocol === $version) {
Expand All @@ -164,16 +179,25 @@ public function withProtocolVersion($version)
return $new;
}

/**
* @return array
*/
public function getHeaders()
{
return $this->headers;
}

/**
* @return bool
*/
public function hasHeader($header)
{
return isset($this->headerNames[strtolower($header)]);
}

/**
* @return array
*/
public function getHeader($header)
{
$header = strtolower($header);
Expand All @@ -187,11 +211,17 @@ public function getHeader($header)
return $this->headers[$header];
}

/**
* @return string
*/
public function getHeaderLine($header)
{
return implode(', ', $this->getHeader($header));
}

/**
* @return static
*/
public function withHeader($header, $value)
{
if (!is_array($value)) {
Expand All @@ -211,6 +241,9 @@ public function withHeader($header, $value)
return $new;
}

/**
* @return static
*/
public function withAddedHeader($header, $value)
{
if (!is_array($value)) {
Expand All @@ -232,6 +265,9 @@ public function withAddedHeader($header, $value)
return $new;
}

/**
* @return static
*/
public function withoutHeader($header)
{
$normalized = strtolower($header);
Expand All @@ -248,6 +284,9 @@ public function withoutHeader($header)
return $new;
}

/**
* @return \StreamInterface
*/
public function getBody()
{
if (!$this->stream) {
Expand All @@ -257,6 +296,9 @@ public function getBody()
return $this->stream;
}

/**
* @return static
*/
public function withBody(StreamInterface $body)
{
if ($body === $this->stream) {
Expand Down

0 comments on commit 0971a49

Please sign in to comment.