From 83381bf5d5ee3b6b1f8ba8a0df99a6abe3ebe6fc Mon Sep 17 00:00:00 2001 From: PJ Dietz Date: Thu, 3 Aug 2017 14:05:02 -0400 Subject: [PATCH] Update PhpDoc return types as static to match updated PSR-7 interfaces --- src/Message/Message.php | 10 +++++----- src/Message/NullStream.php | 1 + src/Message/Request.php | 10 +++++----- src/Message/Response.php | 6 +++--- src/Message/ServerRequest.php | 14 +++++++------- src/Message/Uri.php | 14 +++++++------- 6 files changed, 28 insertions(+), 27 deletions(-) diff --git a/src/Message/Message.php b/src/Message/Message.php index f288af4..6da1f99 100644 --- a/src/Message/Message.php +++ b/src/Message/Message.php @@ -77,7 +77,7 @@ abstract class Message implements MessageInterface * "1.1", "1.0"). * * @param string $version HTTP protocol version - * @return self + * @return static */ public function withProtocolVersion($version) { @@ -192,7 +192,7 @@ abstract class Message implements MessageInterface * * @param string $name Case-insensitive header field name. * @param string|string[] $value Header value(s). - * @return self + * @return static * @throws \InvalidArgumentException for invalid header names or values. */ 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|string[] $value Header value(s). - * @return self + * @return static * @throws \InvalidArgumentException for invalid header names or values. */ public function withAddedHeader($name, $value) @@ -234,7 +234,7 @@ abstract class Message implements MessageInterface * Creates a new instance, without the specified header. * * @param string $name Case-insensitive header field name to remove. - * @return self + * @return static */ public function withoutHeader($name) { @@ -259,7 +259,7 @@ abstract class Message implements MessageInterface * The body MUST be a StreamInterface object. * * @param StreamInterface $body Body. - * @return self + * @return static * @throws \InvalidArgumentException When the body is not valid. */ public function withBody(StreamInterface $body) diff --git a/src/Message/NullStream.php b/src/Message/NullStream.php index 5a82075..bfbc3de 100644 --- a/src/Message/NullStream.php +++ b/src/Message/NullStream.php @@ -37,6 +37,7 @@ class NullStream implements StreamInterface */ public function detach() { + return null; } /** diff --git a/src/Message/Request.php b/src/Message/Request.php index ca96025..114c9f3 100644 --- a/src/Message/Request.php +++ b/src/Message/Request.php @@ -32,7 +32,7 @@ class Request extends Message implements RequestInterface /** * Create a new Request. * - * @see WellRESTed\Message\Message + * @see \WellRESTed\Message\Message * @param UriInterface $uri * @param string $method * @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 * request-target forms allowed in request messages) * @param mixed $requestTarget - * @return self + * @return static */ public function withRequestTarget($requestTarget) { @@ -136,7 +136,7 @@ class Request extends Message implements RequestInterface * modify the given string. * * @param string $method Case-insensitive method. - * @return self + * @return static * @throws \InvalidArgumentException for invalid HTTP methods. */ public function withMethod($method) @@ -182,7 +182,7 @@ class Request extends Message implements RequestInterface * @link http://tools.ietf.org/html/rfc3986#section-4.3 * @param UriInterface $uri New request URI to use. * @param bool $preserveHost Preserve the original state of the Host header. - * @return self + * @return static */ public function withUri(UriInterface $uri, $preserveHost = false) { @@ -212,7 +212,7 @@ class Request extends Message implements RequestInterface /** * @param string $method - * @return string + * @return static * @throws \InvalidArgumentException */ private function getValidatedMethod($method) diff --git a/src/Message/Response.php b/src/Message/Response.php index 2612b64..8718aa2 100644 --- a/src/Message/Response.php +++ b/src/Message/Response.php @@ -33,7 +33,7 @@ class Response extends Message implements ResponseInterface * If no StreamInterface is provided for $body, the instance will create * a NullStream instance for the message body. * - * @see WellRESTed\Message\Message + * @see \WellRESTed\Message\Message * @param int $statusCode * @param array $headers * @param StreamInterface $body @@ -69,11 +69,11 @@ class Response extends Message implements ResponseInterface * reason phrase, if possible. * * @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 * provided status code; if none is provided, implementations MAY * use the defaults as suggested in the HTTP specification. - * @return self + * @return static * @throws \InvalidArgumentException For invalid status code arguments. */ public function withStatus($code, $reasonPhrase = "") diff --git a/src/Message/ServerRequest.php b/src/Message/ServerRequest.php index 842a3a3..a46ed1f 100644 --- a/src/Message/ServerRequest.php +++ b/src/Message/ServerRequest.php @@ -115,7 +115,7 @@ class ServerRequest extends Request implements ServerRequestInterface * be injected at instantiation. * * @param array $cookies Array of key/value pairs representing cookies. - * @return self + * @return static */ 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 * $_GET. - * @return self + * @return static */ public function withQueryParams(array $query) { @@ -187,7 +187,7 @@ class ServerRequest extends Request implements ServerRequestInterface * Create a new instance with the specified uploaded files. * * @param array $uploadedFiles An array tree of UploadedFileInterface instances. - * @return self + * @return static * @throws \InvalidArgumentException if an invalid structure is provided. */ 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 * typically be in an array or object. - * @return self + * @return static */ public function withParsedBody($data) { @@ -303,7 +303,7 @@ class ServerRequest extends Request implements ServerRequestInterface * @see getAttributes() * @param string $name The attribute name. * @param mixed $value The value of the attribute. - * @return self + * @return static */ public function withAttribute($name, $value) { @@ -325,7 +325,7 @@ class ServerRequest extends Request implements ServerRequestInterface * * @see getAttributes() * @param string $name The attribute name. - * @return self + * @return static */ 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. * * @param array $attributes Key-value pairs to add to the request. - * @return self + * @return static * @static */ public static function getServerRequest(array $attributes = null) diff --git a/src/Message/Uri.php b/src/Message/Uri.php index 729a7fd..6feaffb 100644 --- a/src/Message/Uri.php +++ b/src/Message/Uri.php @@ -300,7 +300,7 @@ class Uri implements UriInterface * An empty scheme is equivalent to removing the scheme. * * @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. */ public function withScheme($scheme) @@ -326,7 +326,7 @@ class Uri implements UriInterface * * @param string $user The user name to use for authority. * @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) { @@ -345,7 +345,7 @@ class Uri implements UriInterface * An empty host value is equivalent to removing the host. * * @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. */ 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 * 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. */ public function withPort($port) @@ -407,7 +407,7 @@ class Uri implements UriInterface * Implementations ensure the correct encoding as outlined in getPath(). * * @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. */ public function withPath($path) @@ -432,7 +432,7 @@ class Uri implements UriInterface * An empty query string value is equivalent to removing the query string. * * @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. */ public function withQuery($query) @@ -454,7 +454,7 @@ class Uri implements UriInterface * An empty fragment value is equivalent to removing the fragment. * * @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) {