From ec83c1cc6ce8964da07019c182ed4ace30d5d03e Mon Sep 17 00:00:00 2001 From: erikn69 Date: Thu, 20 Apr 2023 09:23:18 -0500 Subject: [PATCH] Bump psr/http-message version --- Tests/Fixtures/Message.php | 10 +++++----- Tests/Fixtures/Response.php | 2 +- Tests/Fixtures/ServerRequest.php | 31 +++++++++++++++---------------- Tests/Fixtures/UploadedFile.php | 3 ++- Tests/Fixtures/Uri.php | 14 +++++++------- composer.json | 2 +- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Tests/Fixtures/Message.php b/Tests/Fixtures/Message.php index d561086..2f511ae 100644 --- a/Tests/Fixtures/Message.php +++ b/Tests/Fixtures/Message.php @@ -42,7 +42,7 @@ public function getProtocolVersion(): string * * @return static */ - public function withProtocolVersion($version) + public function withProtocolVersion($version): MessageInterface { throw new \BadMethodCallException('Not implemented.'); } @@ -72,7 +72,7 @@ public function getHeaderLine($name): string * * @return static */ - public function withHeader($name, $value) + public function withHeader($name, $value): MessageInterface { $this->headers[$name] = (array) $value; @@ -84,7 +84,7 @@ public function withHeader($name, $value) * * @return static */ - public function withAddedHeader($name, $value) + public function withAddedHeader($name, $value): MessageInterface { throw new \BadMethodCallException('Not implemented.'); } @@ -94,7 +94,7 @@ public function withAddedHeader($name, $value) * * @return static */ - public function withoutHeader($name) + public function withoutHeader($name): MessageInterface { unset($this->headers[$name]); @@ -111,7 +111,7 @@ public function getBody(): StreamInterface * * @return static */ - public function withBody(StreamInterface $body) + public function withBody(StreamInterface $body): MessageInterface { throw new \BadMethodCallException('Not implemented.'); } diff --git a/Tests/Fixtures/Response.php b/Tests/Fixtures/Response.php index 0bcf7f4..e7ec334 100644 --- a/Tests/Fixtures/Response.php +++ b/Tests/Fixtures/Response.php @@ -36,7 +36,7 @@ public function getStatusCode(): int /** * @return static */ - public function withStatus($code, $reasonPhrase = '') + public function withStatus($code, $reasonPhrase = ''): ResponseInterface { throw new \BadMethodCallException('Not implemented.'); } diff --git a/Tests/Fixtures/ServerRequest.php b/Tests/Fixtures/ServerRequest.php index b8df06a..50694cd 100644 --- a/Tests/Fixtures/ServerRequest.php +++ b/Tests/Fixtures/ServerRequest.php @@ -11,6 +11,7 @@ namespace Symfony\Bridge\PsrHttpMessage\Tests\Fixtures; +use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\StreamInterface; use Psr\Http\Message\UriInterface; @@ -34,6 +35,10 @@ public function __construct($version = '1.1', array $headers = [], StreamInterfa { parent::__construct($version, $headers, $body); + if (!($uri instanceof UriInterface)) { + $uri = new Uri((string) $uri); + } + $this->requestTarget = $requestTarget; $this->method = $method; $this->uri = $uri; @@ -52,10 +57,8 @@ public function getRequestTarget(): string /** * {@inheritdoc} - * - * @return static */ - public function withRequestTarget($requestTarget) + public function withRequestTarget($requestTarget): RequestInterface { throw new \BadMethodCallException('Not implemented.'); } @@ -67,20 +70,16 @@ public function getMethod(): string /** * {@inheritdoc} - * - * @return static */ - public function withMethod($method) + public function withMethod($method): RequestInterface { throw new \BadMethodCallException('Not implemented.'); } /** * {@inheritdoc} - * - * @return UriInterface */ - public function getUri() + public function getUri(): UriInterface { return $this->uri; } @@ -90,7 +89,7 @@ public function getUri() * * @return static */ - public function withUri(UriInterface $uri, $preserveHost = false) + public function withUri(UriInterface $uri, $preserveHost = false): RequestInterface { throw new \BadMethodCallException('Not implemented.'); } @@ -110,7 +109,7 @@ public function getCookieParams(): array * * @return static */ - public function withCookieParams(array $cookies) + public function withCookieParams(array $cookies): ServerRequestInterface { throw new \BadMethodCallException('Not implemented.'); } @@ -125,7 +124,7 @@ public function getQueryParams(): array * * @return static */ - public function withQueryParams(array $query) + public function withQueryParams(array $query): ServerRequestInterface { throw new \BadMethodCallException('Not implemented.'); } @@ -140,7 +139,7 @@ public function getUploadedFiles(): array * * @return static */ - public function withUploadedFiles(array $uploadedFiles) + public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface { throw new \BadMethodCallException('Not implemented.'); } @@ -160,7 +159,7 @@ public function getParsedBody() * * @return static */ - public function withParsedBody($data) + public function withParsedBody($data): ServerRequestInterface { throw new \BadMethodCallException('Not implemented.'); } @@ -185,7 +184,7 @@ public function getAttribute($name, $default = null) * * @return static */ - public function withAttribute($name, $value) + public function withAttribute($name, $value): ServerRequestInterface { throw new \BadMethodCallException('Not implemented.'); } @@ -195,7 +194,7 @@ public function withAttribute($name, $value) * * @return static */ - public function withoutAttribute($name) + public function withoutAttribute($name): ServerRequestInterface { throw new \BadMethodCallException('Not implemented.'); } diff --git a/Tests/Fixtures/UploadedFile.php b/Tests/Fixtures/UploadedFile.php index 9004008..7b98057 100644 --- a/Tests/Fixtures/UploadedFile.php +++ b/Tests/Fixtures/UploadedFile.php @@ -11,6 +11,7 @@ namespace Symfony\Bridge\PsrHttpMessage\Tests\Fixtures; +use Psr\Http\Message\StreamInterface; use Psr\Http\Message\UploadedFileInterface; /** @@ -33,7 +34,7 @@ public function __construct($filePath, $size = null, $error = \UPLOAD_ERR_OK, $c $this->clientMediaType = $clientMediaType; } - public function getStream(): Stream + public function getStream(): StreamInterface { return new Stream(file_get_contents($this->filePath)); } diff --git a/Tests/Fixtures/Uri.php b/Tests/Fixtures/Uri.php index 48f513d..d03e032 100644 --- a/Tests/Fixtures/Uri.php +++ b/Tests/Fixtures/Uri.php @@ -98,7 +98,7 @@ public function getFragment(): string * * @return static */ - public function withScheme($scheme) + public function withScheme($scheme): UriInterface { throw new \BadMethodCallException('Not implemented.'); } @@ -108,7 +108,7 @@ public function withScheme($scheme) * * @return static */ - public function withUserInfo($user, $password = null) + public function withUserInfo($user, $password = null): UriInterface { throw new \BadMethodCallException('Not implemented.'); } @@ -118,7 +118,7 @@ public function withUserInfo($user, $password = null) * * @return static */ - public function withHost($host) + public function withHost($host): UriInterface { throw new \BadMethodCallException('Not implemented.'); } @@ -128,7 +128,7 @@ public function withHost($host) * * @return static */ - public function withPort($port) + public function withPort($port): UriInterface { throw new \BadMethodCallException('Not implemented.'); } @@ -138,7 +138,7 @@ public function withPort($port) * * @return static */ - public function withPath($path) + public function withPath($path): UriInterface { throw new \BadMethodCallException('Not implemented.'); } @@ -148,7 +148,7 @@ public function withPath($path) * * @return static */ - public function withQuery($query) + public function withQuery($query): UriInterface { throw new \BadMethodCallException('Not implemented.'); } @@ -158,7 +158,7 @@ public function withQuery($query) * * @return static */ - public function withFragment($fragment) + public function withFragment($fragment): UriInterface { throw new \BadMethodCallException('Not implemented.'); } diff --git a/composer.json b/composer.json index 07968ad..e08b15c 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=7.2.5", - "psr/http-message": "^1.0", + "psr/http-message": "^1.0 || ^2.0", "symfony/http-foundation": "^5.4 || ^6.0" }, "require-dev": {