Skip to content

Commit 5c4395d

Browse files
committed
Bump psr/http-message version
1 parent 694016e commit 5c4395d

File tree

6 files changed

+31
-31
lines changed

6 files changed

+31
-31
lines changed

Tests/Fixtures/Message.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function getProtocolVersion(): string
4242
*
4343
* @return static
4444
*/
45-
public function withProtocolVersion($version)
45+
public function withProtocolVersion($version): MessageInterface
4646
{
4747
throw new \BadMethodCallException('Not implemented.');
4848
}
@@ -72,7 +72,7 @@ public function getHeaderLine($name): string
7272
*
7373
* @return static
7474
*/
75-
public function withHeader($name, $value)
75+
public function withHeader($name, $value): MessageInterface
7676
{
7777
$this->headers[$name] = (array) $value;
7878

@@ -84,7 +84,7 @@ public function withHeader($name, $value)
8484
*
8585
* @return static
8686
*/
87-
public function withAddedHeader($name, $value)
87+
public function withAddedHeader($name, $value): MessageInterface
8888
{
8989
throw new \BadMethodCallException('Not implemented.');
9090
}
@@ -94,7 +94,7 @@ public function withAddedHeader($name, $value)
9494
*
9595
* @return static
9696
*/
97-
public function withoutHeader($name)
97+
public function withoutHeader($name): MessageInterface
9898
{
9999
unset($this->headers[$name]);
100100

@@ -111,7 +111,7 @@ public function getBody(): StreamInterface
111111
*
112112
* @return static
113113
*/
114-
public function withBody(StreamInterface $body)
114+
public function withBody(StreamInterface $body): MessageInterface
115115
{
116116
throw new \BadMethodCallException('Not implemented.');
117117
}

Tests/Fixtures/Response.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function getStatusCode(): int
3636
/**
3737
* @return static
3838
*/
39-
public function withStatus($code, $reasonPhrase = '')
39+
public function withStatus($code, $reasonPhrase = ''): ResponseInterface
4040
{
4141
throw new \BadMethodCallException('Not implemented.');
4242
}

Tests/Fixtures/ServerRequest.php

+15-16
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\PsrHttpMessage\Tests\Fixtures;
1313

14+
use Psr\Http\Message\RequestInterface;
1415
use Psr\Http\Message\ServerRequestInterface;
1516
use Psr\Http\Message\StreamInterface;
1617
use Psr\Http\Message\UriInterface;
@@ -33,6 +34,10 @@ class ServerRequest extends Message implements ServerRequestInterface
3334
public function __construct($version = '1.1', array $headers = [], StreamInterface $body = null, $requestTarget = '/', $method = 'GET', $uri = null, array $server = [], array $cookies = [], array $query = [], array $uploadedFiles = [], $data = null, array $attributes = [])
3435
{
3536
parent::__construct($version, $headers, $body);
37+
38+
if (!($uri instanceof UriInterface)) {
39+
$uri = new Uri((string) $uri);
40+
}
3641

3742
$this->requestTarget = $requestTarget;
3843
$this->method = $method;
@@ -52,10 +57,8 @@ public function getRequestTarget(): string
5257

5358
/**
5459
* {@inheritdoc}
55-
*
56-
* @return static
5760
*/
58-
public function withRequestTarget($requestTarget)
61+
public function withRequestTarget($requestTarget): RequestInterface
5962
{
6063
throw new \BadMethodCallException('Not implemented.');
6164
}
@@ -67,20 +70,16 @@ public function getMethod(): string
6770

6871
/**
6972
* {@inheritdoc}
70-
*
71-
* @return static
7273
*/
73-
public function withMethod($method)
74+
public function withMethod($method): RequestInterface
7475
{
7576
throw new \BadMethodCallException('Not implemented.');
7677
}
7778

7879
/**
7980
* {@inheritdoc}
80-
*
81-
* @return UriInterface
8281
*/
83-
public function getUri()
82+
public function getUri(): UriInterface
8483
{
8584
return $this->uri;
8685
}
@@ -90,7 +89,7 @@ public function getUri()
9089
*
9190
* @return static
9291
*/
93-
public function withUri(UriInterface $uri, $preserveHost = false)
92+
public function withUri(UriInterface $uri, $preserveHost = false): RequestInterface
9493
{
9594
throw new \BadMethodCallException('Not implemented.');
9695
}
@@ -110,7 +109,7 @@ public function getCookieParams(): array
110109
*
111110
* @return static
112111
*/
113-
public function withCookieParams(array $cookies)
112+
public function withCookieParams(array $cookies): ServerRequestInterface
114113
{
115114
throw new \BadMethodCallException('Not implemented.');
116115
}
@@ -125,7 +124,7 @@ public function getQueryParams(): array
125124
*
126125
* @return static
127126
*/
128-
public function withQueryParams(array $query)
127+
public function withQueryParams(array $query): ServerRequestInterface
129128
{
130129
throw new \BadMethodCallException('Not implemented.');
131130
}
@@ -140,7 +139,7 @@ public function getUploadedFiles(): array
140139
*
141140
* @return static
142141
*/
143-
public function withUploadedFiles(array $uploadedFiles)
142+
public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface
144143
{
145144
throw new \BadMethodCallException('Not implemented.');
146145
}
@@ -160,7 +159,7 @@ public function getParsedBody()
160159
*
161160
* @return static
162161
*/
163-
public function withParsedBody($data)
162+
public function withParsedBody($data): ServerRequestInterface
164163
{
165164
throw new \BadMethodCallException('Not implemented.');
166165
}
@@ -185,7 +184,7 @@ public function getAttribute($name, $default = null)
185184
*
186185
* @return static
187186
*/
188-
public function withAttribute($name, $value)
187+
public function withAttribute($name, $value): ServerRequestInterface
189188
{
190189
throw new \BadMethodCallException('Not implemented.');
191190
}
@@ -195,7 +194,7 @@ public function withAttribute($name, $value)
195194
*
196195
* @return static
197196
*/
198-
public function withoutAttribute($name)
197+
public function withoutAttribute($name): ServerRequestInterface
199198
{
200199
throw new \BadMethodCallException('Not implemented.');
201200
}

Tests/Fixtures/UploadedFile.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bridge\PsrHttpMessage\Tests\Fixtures;
1313

1414
use Psr\Http\Message\UploadedFileInterface;
15+
use Psr\Http\Message\StreamInterface ;
1516

1617
/**
1718
* @author Kévin Dunglas <[email protected]>
@@ -33,7 +34,7 @@ public function __construct($filePath, $size = null, $error = \UPLOAD_ERR_OK, $c
3334
$this->clientMediaType = $clientMediaType;
3435
}
3536

36-
public function getStream(): Stream
37+
public function getStream(): StreamInterface
3738
{
3839
return new Stream(file_get_contents($this->filePath));
3940
}

Tests/Fixtures/Uri.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function getFragment(): string
9898
*
9999
* @return static
100100
*/
101-
public function withScheme($scheme)
101+
public function withScheme($scheme): UriInterface
102102
{
103103
throw new \BadMethodCallException('Not implemented.');
104104
}
@@ -108,7 +108,7 @@ public function withScheme($scheme)
108108
*
109109
* @return static
110110
*/
111-
public function withUserInfo($user, $password = null)
111+
public function withUserInfo($user, $password = null): UriInterface
112112
{
113113
throw new \BadMethodCallException('Not implemented.');
114114
}
@@ -118,7 +118,7 @@ public function withUserInfo($user, $password = null)
118118
*
119119
* @return static
120120
*/
121-
public function withHost($host)
121+
public function withHost($host): UriInterface
122122
{
123123
throw new \BadMethodCallException('Not implemented.');
124124
}
@@ -128,7 +128,7 @@ public function withHost($host)
128128
*
129129
* @return static
130130
*/
131-
public function withPort($port)
131+
public function withPort($port): UriInterface
132132
{
133133
throw new \BadMethodCallException('Not implemented.');
134134
}
@@ -138,7 +138,7 @@ public function withPort($port)
138138
*
139139
* @return static
140140
*/
141-
public function withPath($path)
141+
public function withPath($path): UriInterface
142142
{
143143
throw new \BadMethodCallException('Not implemented.');
144144
}
@@ -148,7 +148,7 @@ public function withPath($path)
148148
*
149149
* @return static
150150
*/
151-
public function withQuery($query)
151+
public function withQuery($query): UriInterface
152152
{
153153
throw new \BadMethodCallException('Not implemented.');
154154
}
@@ -158,7 +158,7 @@ public function withQuery($query)
158158
*
159159
* @return static
160160
*/
161-
public function withFragment($fragment)
161+
public function withFragment($fragment): UriInterface
162162
{
163163
throw new \BadMethodCallException('Not implemented.');
164164
}

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
],
1818
"require": {
1919
"php": ">=7.2.5",
20-
"psr/http-message": "^1.0",
20+
"psr/http-message": "^1.0 || ^2.0",
2121
"symfony/http-foundation": "^5.4 || ^6.0"
2222
},
2323
"require-dev": {

0 commit comments

Comments
 (0)