Skip to content

Commit a58fe5f

Browse files
committed
TASK: Upgrade psr/http-message dependency from ^1.0 to ^2.0
1 parent 3a839fa commit a58fe5f

File tree

5 files changed

+26
-27
lines changed

5 files changed

+26
-27
lines changed

Neos.Flow/Classes/Http/ContentStream.php

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static function fromContents(string $contents): self
6969
*
7070
* @return void
7171
*/
72-
public function close()
72+
public function close(): void
7373
{
7474
if (!$this->resource) {
7575
return;
@@ -119,7 +119,7 @@ public function replace($stream, $mode = 'r')
119119
*
120120
* @return int|null Returns the size in bytes if known, or null if unknown.
121121
*/
122-
public function getSize()
122+
public function getSize(): ?int
123123
{
124124
if (!$this->isValidResource($this->resource)) {
125125
return null;
@@ -136,7 +136,7 @@ public function getSize()
136136
* @return int Position of the file pointer
137137
* @throws \RuntimeException on error.
138138
*/
139-
public function tell()
139+
public function tell(): int
140140
{
141141
$this->ensureResourceOpen();
142142

@@ -153,7 +153,7 @@ public function tell()
153153
*
154154
* @return bool
155155
*/
156-
public function eof()
156+
public function eof(): bool
157157
{
158158
if (!$this->isValidResource($this->resource)) {
159159
return true;
@@ -167,7 +167,7 @@ public function eof()
167167
*
168168
* @return bool
169169
*/
170-
public function isSeekable()
170+
public function isSeekable(): bool
171171
{
172172
if (!$this->isValidResource($this->resource)) {
173173
return false;
@@ -188,10 +188,9 @@ public function isSeekable()
188188
* PHP $whence values for `fseek()`. SEEK_SET: Set position equal to
189189
* offset bytes SEEK_CUR: Set position to current location plus offset
190190
* SEEK_END: Set position to end-of-stream plus offset.
191-
* @return bool
192191
* @throws \RuntimeException on failure.
193192
*/
194-
public function seek($offset, $whence = SEEK_SET)
193+
public function seek($offset, $whence = SEEK_SET): void
195194
{
196195
$this->ensureResourceOpen();
197196

@@ -205,7 +204,7 @@ public function seek($offset, $whence = SEEK_SET)
205204
throw new \RuntimeException('Error seeking within stream', 1453892231);
206205
}
207206

208-
return true;
207+
return;
209208
}
210209

211210
/**
@@ -218,17 +217,17 @@ public function seek($offset, $whence = SEEK_SET)
218217
* @link http://www.php.net/manual/en/function.fseek.php
219218
* @throws \RuntimeException on failure.
220219
*/
221-
public function rewind()
220+
public function rewind(): void
222221
{
223-
return $this->seek(0);
222+
$this->seek(0);
224223
}
225224

226225
/**
227226
* Returns whether or not the stream is writable.
228227
*
229228
* @return bool
230229
*/
231-
public function isWritable()
230+
public function isWritable(): bool
232231
{
233232
if (!$this->isValidResource($this->resource)) {
234233
return false;
@@ -253,7 +252,7 @@ public function isWritable()
253252
* @return int Returns the number of bytes written to the stream.
254253
* @throws \RuntimeException on failure.
255254
*/
256-
public function write($string)
255+
public function write($string): int
257256
{
258257
if (!$this->isWritable()) {
259258
throw new \RuntimeException('Stream is not writable', 1453892241);
@@ -273,7 +272,7 @@ public function write($string)
273272
*
274273
* @return bool
275274
*/
276-
public function isReadable()
275+
public function isReadable(): bool
277276
{
278277
if (!$this->isValidResource($this->resource)) {
279278
return false;
@@ -295,7 +294,7 @@ public function isReadable()
295294
* if no bytes are available.
296295
* @throws \RuntimeException if an error occurs.
297296
*/
298-
public function read($length)
297+
public function read($length): string
299298
{
300299
$this->ensureResourceReadable();
301300

@@ -315,7 +314,7 @@ public function read($length)
315314
* @throws \RuntimeException if unable to read or an error occurs while
316315
* reading.
317316
*/
318-
public function getContents()
317+
public function getContents(): string
319318
{
320319
$this->ensureResourceReadable();
321320

@@ -334,12 +333,12 @@ public function getContents()
334333
* stream_get_meta_data() function.
335334
*
336335
* @link http://php.net/manual/en/function.stream-get-meta-data.php
337-
* @param string $key Specific metadata to retrieve.
336+
* @param string|null $key Specific metadata to retrieve.
338337
* @return array|mixed|null Returns an associative array if no key is
339338
* provided. Returns a specific key value if a key is provided and the
340339
* value is found, or null if the key is not found.
341340
*/
342-
public function getMetadata($key = null)
341+
public function getMetadata(?string $key = null)
343342
{
344343
if ($key === null) {
345344
return stream_get_meta_data($this->resource);
@@ -395,7 +394,7 @@ protected function isValidResource($resource)
395394
* @see http://php.net/manual/en/language.oop5.magic.php#object.tostring
396395
* @return string
397396
*/
398-
public function __toString()
397+
public function __toString(): string
399398
{
400399
if (!$this->isReadable()) {
401400
return '';

Neos.Flow/Classes/Http/UploadedFile.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function isMoved()
127127
* @throws RuntimeException if the upload was not successful.
128128
* @api PSR-7
129129
*/
130-
public function getStream()
130+
public function getStream(): StreamInterface
131131
{
132132
$this->throwExceptionIfNotAccessible();
133133

@@ -172,7 +172,7 @@ public function getStream()
172172
* the second or subsequent call to the method.
173173
* @api PSR-7
174174
*/
175-
public function moveTo($targetPath)
175+
public function moveTo($targetPath): void
176176
{
177177
$this->throwExceptionIfNotAccessible();
178178

@@ -203,7 +203,7 @@ public function moveTo($targetPath)
203203
* @return int|null The file size in bytes or null if unknown.
204204
* @api PSR-7
205205
*/
206-
public function getSize()
206+
public function getSize(): ?int
207207
{
208208
return $this->size;
209209
}
@@ -223,7 +223,7 @@ public function getSize()
223223
* @return int One of PHP's UPLOAD_ERR_XXX constants.
224224
* @api PSR-7
225225
*/
226-
public function getError()
226+
public function getError(): int
227227
{
228228
return $this->error;
229229
}
@@ -242,7 +242,7 @@ public function getError()
242242
* was provided.
243243
* @api PSR-7
244244
*/
245-
public function getClientFilename()
245+
public function getClientFilename(): ?string
246246
{
247247
return $this->clientFilename;
248248
}
@@ -259,7 +259,7 @@ public function getClientFilename()
259259
*
260260
* @api PSR-7
261261
*/
262-
public function getClientMediaType()
262+
public function getClientMediaType(): ?string
263263
{
264264
return $this->clientMediaType;
265265
}

Neos.Flow/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
"neos/composer-plugin": "^2.0",
3333

34-
"psr/http-message": "^1.0",
34+
"psr/http-message": "^2.0",
3535
"psr/http-factory": "^1.0",
3636
"psr/container": "^2.0",
3737
"psr/log": "^2.0 || ^3.0",

Neos.Http.Factories/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"require": {
1010
"php": "^8.2",
11-
"psr/http-factory": "^1.0",
11+
"psr/http-factory": "^2.0",
1212
"guzzlehttp/psr7": "^1.8.4 || ^2.1.1"
1313
},
1414
"autoload": {

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"ext-xml": "*",
2929
"ext-xmlreader": "*",
3030
"neos/composer-plugin": "^2.0",
31-
"psr/http-message": "^1.0",
31+
"psr/http-message": "^2.0",
3232
"psr/http-factory": "^1.0",
3333
"psr/container": "^2.0",
3434
"psr/http-server-middleware": "^1.0",

0 commit comments

Comments
 (0)