Skip to content

Commit 069b861

Browse files
committed
Merge #19887 - Migrate psr/http-message to v2
Pull-request: #19887 Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
2 parents ccdcb9c + 66b797e commit 069b861

3 files changed

Lines changed: 39 additions & 48 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"phpmyadmin/sql-parser": "^6.0-dev",
6767
"psr/container": "^2.0",
6868
"psr/http-factory": "^1.0",
69-
"psr/http-message": "^1.1",
69+
"psr/http-message": "^2",
7070
"psr/http-server-handler": "^1.0",
7171
"psr/http-server-middleware": "^1.0",
7272
"slim/psr7": "^1.6.1",

composer.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Http/ServerRequest.php

Lines changed: 29 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace PhpMyAdmin\Http;
66

77
use Fig\Http\Message\RequestMethodInterface;
8+
use Psr\Http\Message\MessageInterface;
89
use Psr\Http\Message\ServerRequestInterface;
910
use Psr\Http\Message\StreamInterface;
1011
use Psr\Http\Message\UriInterface;
@@ -21,166 +22,157 @@ final public function __construct(private ServerRequestInterface $serverRequest)
2122
{
2223
}
2324

24-
/** @inheritDoc */
25-
public function getProtocolVersion()
25+
public function getProtocolVersion(): string
2626
{
2727
return $this->serverRequest->getProtocolVersion();
2828
}
2929

3030
/** @inheritDoc */
31-
public function withProtocolVersion($version)
31+
public function withProtocolVersion($version): MessageInterface
3232
{
3333
$serverRequest = $this->serverRequest->withProtocolVersion($version);
3434

3535
return new static($serverRequest);
3636
}
3737

3838
/** @inheritDoc */
39-
public function getHeaders()
39+
public function getHeaders(): array
4040
{
4141
return $this->serverRequest->getHeaders();
4242
}
4343

44-
/** @inheritDoc */
45-
public function hasHeader($name)
44+
public function hasHeader(string $name): bool
4645
{
4746
return $this->serverRequest->hasHeader($name);
4847
}
4948

5049
/** @inheritDoc */
51-
public function getHeader($name)
50+
public function getHeader(string $name): array
5251
{
5352
return $this->serverRequest->getHeader($name);
5453
}
5554

56-
/** @inheritDoc */
57-
public function getHeaderLine($name)
55+
public function getHeaderLine(string $name): string
5856
{
5957
return $this->serverRequest->getHeaderLine($name);
6058
}
6159

6260
/** @inheritDoc */
63-
public function withHeader($name, $value)
61+
public function withHeader(string $name, $value): MessageInterface
6462
{
6563
$serverRequest = $this->serverRequest->withHeader($name, $value);
6664

6765
return new static($serverRequest);
6866
}
6967

7068
/** @inheritDoc */
71-
public function withAddedHeader($name, $value)
69+
public function withAddedHeader(string $name, $value): MessageInterface
7270
{
7371
$serverRequest = $this->serverRequest->withAddedHeader($name, $value);
7472

7573
return new static($serverRequest);
7674
}
7775

78-
/** @inheritDoc */
79-
public function withoutHeader($name)
76+
public function withoutHeader(string $name): MessageInterface
8077
{
8178
$serverRequest = $this->serverRequest->withoutHeader($name);
8279

8380
return new static($serverRequest);
8481
}
8582

86-
/** @inheritDoc */
87-
public function getBody()
83+
public function getBody(): StreamInterface
8884
{
8985
return $this->serverRequest->getBody();
9086
}
9187

92-
/** @inheritDoc */
93-
public function withBody(StreamInterface $body)
88+
public function withBody(StreamInterface $body): MessageInterface
9489
{
9590
$serverRequest = $this->serverRequest->withBody($body);
9691

9792
return new static($serverRequest);
9893
}
9994

100-
/** @inheritDoc */
101-
public function getRequestTarget()
95+
public function getRequestTarget(): string
10296
{
10397
return $this->serverRequest->getRequestTarget();
10498
}
10599

106100
/** @inheritDoc */
107-
public function withRequestTarget($requestTarget)
101+
public function withRequestTarget($requestTarget): ServerRequestInterface
108102
{
109103
$serverRequest = $this->serverRequest->withRequestTarget($requestTarget);
110104

111105
return new static($serverRequest);
112106
}
113107

114-
/** @inheritDoc */
115-
public function getMethod()
108+
public function getMethod(): string
116109
{
117110
return $this->serverRequest->getMethod();
118111
}
119112

120113
/** @inheritDoc */
121-
public function withMethod($method)
114+
public function withMethod($method): ServerRequestInterface
122115
{
123116
$serverRequest = $this->serverRequest->withMethod($method);
124117

125118
return new static($serverRequest);
126119
}
127120

128-
/** @inheritDoc */
129-
public function getUri()
121+
public function getUri(): UriInterface
130122
{
131123
return $this->serverRequest->getUri();
132124
}
133125

134126
/** @inheritDoc */
135-
public function withUri(UriInterface $uri, $preserveHost = false)
127+
public function withUri(UriInterface $uri, $preserveHost = false): ServerRequestInterface
136128
{
137129
$serverRequest = $this->serverRequest->withUri($uri, $preserveHost);
138130

139131
return new static($serverRequest);
140132
}
141133

142134
/** @inheritDoc */
143-
public function getServerParams()
135+
public function getServerParams(): array
144136
{
145137
return $this->serverRequest->getServerParams();
146138
}
147139

148140
/** @inheritDoc */
149-
public function getCookieParams()
141+
public function getCookieParams(): array
150142
{
151143
return $this->serverRequest->getCookieParams();
152144
}
153145

154146
/** @inheritDoc */
155-
public function withCookieParams(array $cookies)
147+
public function withCookieParams(array $cookies): ServerRequestInterface
156148
{
157149
$serverRequest = $this->serverRequest->withCookieParams($cookies);
158150

159151
return new static($serverRequest);
160152
}
161153

162154
/** @inheritDoc */
163-
public function getQueryParams()
155+
public function getQueryParams(): array
164156
{
165157
return $this->serverRequest->getQueryParams();
166158
}
167159

168160
/** @inheritDoc */
169-
public function withQueryParams(array $query)
161+
public function withQueryParams(array $query): ServerRequestInterface
170162
{
171163
$serverRequest = $this->serverRequest->withQueryParams($query);
172164

173165
return new static($serverRequest);
174166
}
175167

176168
/** @inheritDoc */
177-
public function getUploadedFiles()
169+
public function getUploadedFiles(): array
178170
{
179171
return $this->serverRequest->getUploadedFiles();
180172
}
181173

182174
/** @inheritDoc */
183-
public function withUploadedFiles(array $uploadedFiles)
175+
public function withUploadedFiles(array $uploadedFiles): ServerRequestInterface
184176
{
185177
$serverRequest = $this->serverRequest->withUploadedFiles($uploadedFiles);
186178

@@ -194,15 +186,15 @@ public function getParsedBody()
194186
}
195187

196188
/** @inheritDoc */
197-
public function withParsedBody($data)
189+
public function withParsedBody($data): ServerRequestInterface
198190
{
199191
$serverRequest = $this->serverRequest->withParsedBody($data);
200192

201193
return new static($serverRequest);
202194
}
203195

204196
/** @inheritDoc */
205-
public function getAttributes()
197+
public function getAttributes(): array
206198
{
207199
return $this->serverRequest->getAttributes();
208200
}
@@ -214,15 +206,14 @@ public function getAttribute($name, $default = null)
214206
}
215207

216208
/** @inheritDoc */
217-
public function withAttribute($name, $value)
209+
public function withAttribute($name, $value): ServerRequestInterface
218210
{
219211
$serverRequest = $this->serverRequest->withAttribute($name, $value);
220212

221213
return new static($serverRequest);
222214
}
223215

224-
/** @inheritDoc */
225-
public function withoutAttribute($name)
216+
public function withoutAttribute(string $name): ServerRequestInterface
226217
{
227218
$serverRequest = $this->serverRequest->withoutAttribute($name);
228219

0 commit comments

Comments
 (0)