Update PhpDoc return types as static to match updated PSR-7 interfaces

This commit is contained in:
PJ Dietz 2017-08-03 14:05:02 -04:00
parent 36a170bcff
commit 83381bf5d5
6 changed files with 28 additions and 27 deletions

View File

@ -77,7 +77,7 @@ abstract class Message implements MessageInterface
* "1.1", "1.0"). * "1.1", "1.0").
* *
* @param string $version HTTP protocol version * @param string $version HTTP protocol version
* @return self * @return static
*/ */
public function withProtocolVersion($version) public function withProtocolVersion($version)
{ {
@ -192,7 +192,7 @@ abstract class Message implements MessageInterface
* *
* @param string $name Case-insensitive header field name. * @param string $name Case-insensitive header field name.
* @param string|string[] $value Header value(s). * @param string|string[] $value Header value(s).
* @return self * @return static
* @throws \InvalidArgumentException for invalid header names or values. * @throws \InvalidArgumentException for invalid header names or values.
*/ */
public function withHeader($name, $value) public function withHeader($name, $value)
@ -216,7 +216,7 @@ abstract class Message implements MessageInterface
* *
* @param string $name Case-insensitive header field name to add. * @param string $name Case-insensitive header field name to add.
* @param string|string[] $value Header value(s). * @param string|string[] $value Header value(s).
* @return self * @return static
* @throws \InvalidArgumentException for invalid header names or values. * @throws \InvalidArgumentException for invalid header names or values.
*/ */
public function withAddedHeader($name, $value) public function withAddedHeader($name, $value)
@ -234,7 +234,7 @@ abstract class Message implements MessageInterface
* Creates a new instance, without the specified header. * Creates a new instance, without the specified header.
* *
* @param string $name Case-insensitive header field name to remove. * @param string $name Case-insensitive header field name to remove.
* @return self * @return static
*/ */
public function withoutHeader($name) public function withoutHeader($name)
{ {
@ -259,7 +259,7 @@ abstract class Message implements MessageInterface
* The body MUST be a StreamInterface object. * The body MUST be a StreamInterface object.
* *
* @param StreamInterface $body Body. * @param StreamInterface $body Body.
* @return self * @return static
* @throws \InvalidArgumentException When the body is not valid. * @throws \InvalidArgumentException When the body is not valid.
*/ */
public function withBody(StreamInterface $body) public function withBody(StreamInterface $body)

View File

@ -37,6 +37,7 @@ class NullStream implements StreamInterface
*/ */
public function detach() public function detach()
{ {
return null;
} }
/** /**

View File

@ -32,7 +32,7 @@ class Request extends Message implements RequestInterface
/** /**
* Create a new Request. * Create a new Request.
* *
* @see WellRESTed\Message\Message * @see \WellRESTed\Message\Message
* @param UriInterface $uri * @param UriInterface $uri
* @param string $method * @param string $method
* @param array $headers * @param array $headers
@ -109,7 +109,7 @@ class Request extends Message implements RequestInterface
* @link http://tools.ietf.org/html/rfc7230#section-2.7 (for the various * @link http://tools.ietf.org/html/rfc7230#section-2.7 (for the various
* request-target forms allowed in request messages) * request-target forms allowed in request messages)
* @param mixed $requestTarget * @param mixed $requestTarget
* @return self * @return static
*/ */
public function withRequestTarget($requestTarget) public function withRequestTarget($requestTarget)
{ {
@ -136,7 +136,7 @@ class Request extends Message implements RequestInterface
* modify the given string. * modify the given string.
* *
* @param string $method Case-insensitive method. * @param string $method Case-insensitive method.
* @return self * @return static
* @throws \InvalidArgumentException for invalid HTTP methods. * @throws \InvalidArgumentException for invalid HTTP methods.
*/ */
public function withMethod($method) public function withMethod($method)
@ -182,7 +182,7 @@ class Request extends Message implements RequestInterface
* @link http://tools.ietf.org/html/rfc3986#section-4.3 * @link http://tools.ietf.org/html/rfc3986#section-4.3
* @param UriInterface $uri New request URI to use. * @param UriInterface $uri New request URI to use.
* @param bool $preserveHost Preserve the original state of the Host header. * @param bool $preserveHost Preserve the original state of the Host header.
* @return self * @return static
*/ */
public function withUri(UriInterface $uri, $preserveHost = false) public function withUri(UriInterface $uri, $preserveHost = false)
{ {
@ -212,7 +212,7 @@ class Request extends Message implements RequestInterface
/** /**
* @param string $method * @param string $method
* @return string * @return static
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
private function getValidatedMethod($method) private function getValidatedMethod($method)

View File

@ -33,7 +33,7 @@ class Response extends Message implements ResponseInterface
* If no StreamInterface is provided for $body, the instance will create * If no StreamInterface is provided for $body, the instance will create
* a NullStream instance for the message body. * a NullStream instance for the message body.
* *
* @see WellRESTed\Message\Message * @see \WellRESTed\Message\Message
* @param int $statusCode * @param int $statusCode
* @param array $headers * @param array $headers
* @param StreamInterface $body * @param StreamInterface $body
@ -69,11 +69,11 @@ class Response extends Message implements ResponseInterface
* reason phrase, if possible. * reason phrase, if possible.
* *
* @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml * @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
* @param integer $code The 3-digit integer result code to set. * @param int $code The 3-digit integer result code to set.
* @param string $reasonPhrase The reason phrase to use with the * @param string $reasonPhrase The reason phrase to use with the
* provided status code; if none is provided, implementations MAY * provided status code; if none is provided, implementations MAY
* use the defaults as suggested in the HTTP specification. * use the defaults as suggested in the HTTP specification.
* @return self * @return static
* @throws \InvalidArgumentException For invalid status code arguments. * @throws \InvalidArgumentException For invalid status code arguments.
*/ */
public function withStatus($code, $reasonPhrase = "") public function withStatus($code, $reasonPhrase = "")

View File

@ -115,7 +115,7 @@ class ServerRequest extends Request implements ServerRequestInterface
* be injected at instantiation. * be injected at instantiation.
* *
* @param array $cookies Array of key/value pairs representing cookies. * @param array $cookies Array of key/value pairs representing cookies.
* @return self * @return static
*/ */
public function withCookieParams(array $cookies) public function withCookieParams(array $cookies)
{ {
@ -157,7 +157,7 @@ class ServerRequest extends Request implements ServerRequestInterface
* *
* @param array $query Array of query string arguments, typically from * @param array $query Array of query string arguments, typically from
* $_GET. * $_GET.
* @return self * @return static
*/ */
public function withQueryParams(array $query) public function withQueryParams(array $query)
{ {
@ -187,7 +187,7 @@ class ServerRequest extends Request implements ServerRequestInterface
* Create a new instance with the specified uploaded files. * Create a new instance with the specified uploaded files.
* *
* @param array $uploadedFiles An array tree of UploadedFileInterface instances. * @param array $uploadedFiles An array tree of UploadedFileInterface instances.
* @return self * @return static
* @throws \InvalidArgumentException if an invalid structure is provided. * @throws \InvalidArgumentException if an invalid structure is provided.
*/ */
public function withUploadedFiles(array $uploadedFiles) public function withUploadedFiles(array $uploadedFiles)
@ -242,7 +242,7 @@ class ServerRequest extends Request implements ServerRequestInterface
* *
* @param null|array|object $data The deserialized body data. This will * @param null|array|object $data The deserialized body data. This will
* typically be in an array or object. * typically be in an array or object.
* @return self * @return static
*/ */
public function withParsedBody($data) public function withParsedBody($data)
{ {
@ -303,7 +303,7 @@ class ServerRequest extends Request implements ServerRequestInterface
* @see getAttributes() * @see getAttributes()
* @param string $name The attribute name. * @param string $name The attribute name.
* @param mixed $value The value of the attribute. * @param mixed $value The value of the attribute.
* @return self * @return static
*/ */
public function withAttribute($name, $value) public function withAttribute($name, $value)
{ {
@ -325,7 +325,7 @@ class ServerRequest extends Request implements ServerRequestInterface
* *
* @see getAttributes() * @see getAttributes()
* @param string $name The attribute name. * @param string $name The attribute name.
* @return self * @return static
*/ */
public function withoutAttribute($name) public function withoutAttribute($name)
{ {
@ -446,7 +446,7 @@ class ServerRequest extends Request implements ServerRequestInterface
* from the server's information about the request sent to the server. * from the server's information about the request sent to the server.
* *
* @param array $attributes Key-value pairs to add to the request. * @param array $attributes Key-value pairs to add to the request.
* @return self * @return static
* @static * @static
*/ */
public static function getServerRequest(array $attributes = null) public static function getServerRequest(array $attributes = null)

View File

@ -300,7 +300,7 @@ class Uri implements UriInterface
* An empty scheme is equivalent to removing the scheme. * An empty scheme is equivalent to removing the scheme.
* *
* @param string $scheme The scheme to use with the new instance. * @param string $scheme The scheme to use with the new instance.
* @return self A new instance with the specified scheme. * @return static A new instance with the specified scheme.
* @throws \InvalidArgumentException for invalid or unsupported schemes. * @throws \InvalidArgumentException for invalid or unsupported schemes.
*/ */
public function withScheme($scheme) public function withScheme($scheme)
@ -326,7 +326,7 @@ class Uri implements UriInterface
* *
* @param string $user The user name to use for authority. * @param string $user The user name to use for authority.
* @param null|string $password The password associated with $user. * @param null|string $password The password associated with $user.
* @return self A new instance with the specified user information. * @return static A new instance with the specified user information.
*/ */
public function withUserInfo($user, $password = null) public function withUserInfo($user, $password = null)
{ {
@ -345,7 +345,7 @@ class Uri implements UriInterface
* An empty host value is equivalent to removing the host. * An empty host value is equivalent to removing the host.
* *
* @param string $host The hostname to use with the new instance. * @param string $host The hostname to use with the new instance.
* @return self A new instance with the specified host. * @return static A new instance with the specified host.
* @throws \InvalidArgumentException for invalid hostnames. * @throws \InvalidArgumentException for invalid hostnames.
*/ */
public function withHost($host) public function withHost($host)
@ -373,7 +373,7 @@ class Uri implements UriInterface
* *
* @param null|int $port The port to use with the new instance; a null value * @param null|int $port The port to use with the new instance; a null value
* removes the port information. * removes the port information.
* @return self A new instance with the specified port. * @return static A new instance with the specified port.
* @throws \InvalidArgumentException for invalid ports. * @throws \InvalidArgumentException for invalid ports.
*/ */
public function withPort($port) public function withPort($port)
@ -407,7 +407,7 @@ class Uri implements UriInterface
* Implementations ensure the correct encoding as outlined in getPath(). * Implementations ensure the correct encoding as outlined in getPath().
* *
* @param string $path The path to use with the new instance. * @param string $path The path to use with the new instance.
* @return self A new instance with the specified path. * @return static A new instance with the specified path.
* @throws \InvalidArgumentException for invalid paths. * @throws \InvalidArgumentException for invalid paths.
*/ */
public function withPath($path) public function withPath($path)
@ -432,7 +432,7 @@ class Uri implements UriInterface
* An empty query string value is equivalent to removing the query string. * An empty query string value is equivalent to removing the query string.
* *
* @param string $query The query string to use with the new instance. * @param string $query The query string to use with the new instance.
* @return self A new instance with the specified query string. * @return static A new instance with the specified query string.
* @throws \InvalidArgumentException for invalid query strings. * @throws \InvalidArgumentException for invalid query strings.
*/ */
public function withQuery($query) public function withQuery($query)
@ -454,7 +454,7 @@ class Uri implements UriInterface
* An empty fragment value is equivalent to removing the fragment. * An empty fragment value is equivalent to removing the fragment.
* *
* @param string $fragment The fragment to use with the new instance. * @param string $fragment The fragment to use with the new instance.
* @return self A new instance with the specified fragment. * @return static A new instance with the specified fragment.
*/ */
public function withFragment($fragment) public function withFragment($fragment)
{ {