From d9306b7288ecf040e9dc1d3b17d42f23489907c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1?= Date: Thu, 14 Mar 2024 08:57:08 +0100 Subject: [PATCH 1/5] phpstan fix --- src/Request.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Request.php b/src/Request.php index 252f5a1..4f9e1d9 100644 --- a/src/Request.php +++ b/src/Request.php @@ -270,7 +270,6 @@ public function getQueryParams(): array // Decode URL data parse_str($this->uri->getQuery(), $this->queryParams); - // @phpstan-ignore-next-line return is_array($this->queryParams) ? $this->queryParams : []; } From 36998c95b06c5ebddf0a720cef72ca1984674b76 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Thu, 21 Mar 2024 15:26:14 +0100 Subject: [PATCH 2/5] Fix implicitly nullable params --- src/Factory/StreamFactory.php | 4 ++-- tests/bootstrap.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Factory/StreamFactory.php b/src/Factory/StreamFactory.php index 31d99b5..04d22a1 100644 --- a/src/Factory/StreamFactory.php +++ b/src/Factory/StreamFactory.php @@ -51,7 +51,7 @@ public function createStream(string $content = ''): StreamInterface public function createStreamFromFile( string $filename, string $mode = 'r', - StreamInterface $cache = null + ?StreamInterface $cache = null ): StreamInterface { set_error_handler( static function (int $errno, string $errstr) use ($filename, $mode): void { @@ -82,7 +82,7 @@ static function (int $errno, string $errstr) use ($filename, $mode): void { /** * {@inheritdoc} */ - public function createStreamFromResource($resource, StreamInterface $cache = null): StreamInterface + public function createStreamFromResource($resource, ?StreamInterface $cache = null): StreamInterface { if (!is_resource($resource)) { throw new InvalidArgumentException( diff --git a/tests/bootstrap.php b/tests/bootstrap.php index dbe4a90..eee5637 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -29,7 +29,7 @@ } ], Message::class => [ - 'header' => function (string $string, bool $replace = true, int $statusCode = null): void { + 'header' => function (string $string, bool $replace = true, ?int $statusCode = null): void { HeaderStack::push( [ 'header' => $string, From 4930c30af8834ab9df033d7609ff42950062f49d Mon Sep 17 00:00:00 2001 From: Rob Allen Date: Sat, 8 Jun 2024 15:25:42 +0100 Subject: [PATCH 3/5] Add PHP8.3 to the CI matrix --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7e8ec2f..bb85a67 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - php: [8.0, 8.1, 8.2] + php: [8.0, 8.1, 8.2, 8.3] experimental: [false] include: - php: 8.2 From ad89d922dd845325b0253f5fde2660cc0b264ecd Mon Sep 17 00:00:00 2001 From: Rob Allen Date: Sat, 8 Jun 2024 15:31:15 +0100 Subject: [PATCH 4/5] Update phpstan config for ignoring iterable value types --- phpstan.neon.dist | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index ccac1b2..8216eb2 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,5 +1,6 @@ parameters: level: max - checkMissingIterableValueType: false + ignoreErrors: + - identifier: missingType.iterableValue paths: - src From d7b67674d7d854c380de67d62980c9c28ca33592 Mon Sep 17 00:00:00 2001 From: Rob Allen Date: Sat, 8 Jun 2024 15:31:44 +0100 Subject: [PATCH 5/5] Only read the stream if the length > 0 --- src/Stream.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Stream.php b/src/Stream.php index fa8e268..25a97f8 100644 --- a/src/Stream.php +++ b/src/Stream.php @@ -304,7 +304,7 @@ public function read($length): string { $data = false; - if ($this->isReadable() && $this->stream && $length >= 0) { + if ($this->isReadable() && $this->stream && $length > 0) { $data = fread($this->stream, $length); }