Skip to content

Commit

Permalink
Add @return to define the return type for non-PHP 7.2 compatible ty…
Browse files Browse the repository at this point in the history
…pes (#444)
  • Loading branch information
wouterj committed Sep 19, 2021
1 parent 4095c77 commit a613efc
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/AppendStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ public function write($string): int
throw new \RuntimeException('Cannot write to an AppendStream');
}

/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)
{
return $key ? null : [];
Expand Down
5 changes: 5 additions & 0 deletions src/BufferStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ public function write($string): int
return strlen($string);
}

/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)
{
if ($key === 'hwm') {
Expand Down
5 changes: 5 additions & 0 deletions src/FnStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ public function getContents(): string
return call_user_func($this->_fn_getContents);
}

/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)
{
return call_user_func($this->_fn_getMetadata, $key);
Expand Down
5 changes: 5 additions & 0 deletions src/PumpStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ public function getContents(): string
return $result;
}

/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)
{
if (!$key) {
Expand Down
10 changes: 10 additions & 0 deletions src/ServerRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ public function withQueryParams(array $query): ServerRequestInterface
return $new;
}

/**
* {@inheritdoc}
*
* @return array|object|null
*/
public function getParsedBody()
{
return $this->parsedBody;
Expand All @@ -303,6 +308,11 @@ public function getAttributes(): array
return $this->attributes;
}

/**
* {@inheritdoc}
*
* @return mixed
*/
public function getAttribute($attribute, $default = null)
{
if (false === array_key_exists($attribute, $this->attributes)) {
Expand Down
5 changes: 5 additions & 0 deletions src/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ public function write($string): int
return $result;
}

/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)
{
if (!isset($this->stream)) {
Expand Down
5 changes: 5 additions & 0 deletions src/StreamDecoratorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ public function close(): void
$this->stream->close();
}

/**
* {@inheritdoc}
*
* @return mixed
*/
public function getMetadata($key = null)
{
return $this->stream->getMetadata($key);
Expand Down

0 comments on commit a613efc

Please sign in to comment.