diff --git a/phpstan-baseline.php b/phpstan-baseline.php index e775d6b9f5ef..5cf21e95d939 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -7543,12 +7543,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Images/Handlers/BaseHandler.php', ]; -$ignoreErrors[] = [ - // identifier: return.missing - 'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:__call\\(\\) should return mixed but return statement is missing\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Images/Handlers/BaseHandler.php', -]; $ignoreErrors[] = [ // identifier: missingType.iterableValue 'message' => '#^Method CodeIgniter\\\\Images\\\\Handlers\\\\BaseHandler\\:\\:_text\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#', @@ -7699,12 +7693,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Language/Language.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.iterableValue - 'message' => '#^Method CodeIgniter\\\\Language\\\\Language\\:\\:load\\(\\) return type has no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Language/Language.php', -]; $ignoreErrors[] = [ // identifier: missingType.iterableValue 'message' => '#^Method CodeIgniter\\\\Language\\\\Language\\:\\:parseLine\\(\\) return type has no value type specified in iterable type array\\.$#', diff --git a/system/Filters/CSRF.php b/system/Filters/CSRF.php index 6d90d6aee817..ea9a9939f2de 100644 --- a/system/Filters/CSRF.php +++ b/system/Filters/CSRF.php @@ -65,10 +65,9 @@ public function before(RequestInterface $request, $arguments = null) * We don't have anything to do here. * * @param list|null $arguments - * - * @return void */ public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { + return null; } } diff --git a/system/Filters/DebugToolbar.php b/system/Filters/DebugToolbar.php index 9f864ee572c5..9e888ead35bb 100644 --- a/system/Filters/DebugToolbar.php +++ b/system/Filters/DebugToolbar.php @@ -30,6 +30,7 @@ class DebugToolbar implements FilterInterface */ public function before(RequestInterface $request, $arguments = null) { + return null; } /** @@ -41,5 +42,7 @@ public function before(RequestInterface $request, $arguments = null) public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { service('toolbar')->prepare($request, $response); + + return $response; } } diff --git a/system/Filters/FilterInterface.php b/system/Filters/FilterInterface.php index 0353fb2ab9d0..6df33e912b87 100644 --- a/system/Filters/FilterInterface.php +++ b/system/Filters/FilterInterface.php @@ -33,7 +33,7 @@ interface FilterInterface * * @param list|null $arguments * - * @return RequestInterface|ResponseInterface|string|void + * @return RequestInterface|ResponseInterface|string|null */ public function before(RequestInterface $request, $arguments = null); @@ -45,7 +45,7 @@ public function before(RequestInterface $request, $arguments = null); * * @param list|null $arguments * - * @return ResponseInterface|void + * @return ResponseInterface|null */ public function after(RequestInterface $request, ResponseInterface $response, $arguments = null); } diff --git a/system/Filters/ForceHTTPS.php b/system/Filters/ForceHTTPS.php index 1a5bdc84349d..aa9cb3716d08 100644 --- a/system/Filters/ForceHTTPS.php +++ b/system/Filters/ForceHTTPS.php @@ -57,10 +57,9 @@ public function before(RequestInterface $request, $arguments = null) * We don't have anything to do here. * * @param array|null $arguments - * - * @return void */ public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { + return null; } } diff --git a/system/Filters/Honeypot.php b/system/Filters/Honeypot.php index cdff293aacb4..0a2745963595 100644 --- a/system/Filters/Honeypot.php +++ b/system/Filters/Honeypot.php @@ -36,12 +36,14 @@ class Honeypot implements FilterInterface public function before(RequestInterface $request, $arguments = null) { if (! $request instanceof IncomingRequest) { - return; + return null; } if (service('honeypot')->hasContent($request)) { throw HoneypotException::isBot(); } + + return null; } /** @@ -52,5 +54,7 @@ public function before(RequestInterface $request, $arguments = null) public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { service('honeypot')->attachHoneypot($response); + + return $response; } } diff --git a/system/Filters/InvalidChars.php b/system/Filters/InvalidChars.php index 542b12d7ffbe..1cd775153c0e 100644 --- a/system/Filters/InvalidChars.php +++ b/system/Filters/InvalidChars.php @@ -48,13 +48,11 @@ class InvalidChars implements FilterInterface * Check invalid characters. * * @param list|null $arguments - * - * @return void */ public function before(RequestInterface $request, $arguments = null) { if (! $request instanceof IncomingRequest) { - return; + return null; } $data = [ @@ -69,17 +67,18 @@ public function before(RequestInterface $request, $arguments = null) $this->checkEncoding($values); $this->checkControl($values); } + + return null; } /** * We don't have anything to do here. * * @param list|null $arguments - * - * @return void */ public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { + return null; } /** diff --git a/system/Filters/PageCache.php b/system/Filters/PageCache.php index d4fb6ab24662..76a3faaaf7e1 100644 --- a/system/Filters/PageCache.php +++ b/system/Filters/PageCache.php @@ -59,8 +59,6 @@ public function before(RequestInterface $request, $arguments = null) * Cache the page. * * @param array|null $arguments - * - * @return void */ public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { @@ -74,6 +72,9 @@ public function after(RequestInterface $request, ResponseInterface $response, $a // so that we can have live speed updates along the way. // Must be run after filters to preserve the Response headers. $this->pageCache->make($request, $response); + return $response; } + + return null; } } diff --git a/system/Filters/PerformanceMetrics.php b/system/Filters/PerformanceMetrics.php index f2371c7a8d6d..0a9db2078500 100644 --- a/system/Filters/PerformanceMetrics.php +++ b/system/Filters/PerformanceMetrics.php @@ -28,14 +28,13 @@ class PerformanceMetrics implements FilterInterface */ public function before(RequestInterface $request, $arguments = null) { + return null; } /** * Replaces the performance metrics. * * @param array|null $arguments - * - * @return void */ public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { @@ -57,6 +56,10 @@ public function after(RequestInterface $request, ResponseInterface $response, $a ); $response->setBody($output); + + return $response; } + + return null; } } diff --git a/system/Filters/SecureHeaders.php b/system/Filters/SecureHeaders.php index b8bd6e05f8eb..42e5842384db 100644 --- a/system/Filters/SecureHeaders.php +++ b/system/Filters/SecureHeaders.php @@ -52,24 +52,23 @@ class SecureHeaders implements FilterInterface * We don't have anything to do here. * * @param list|null $arguments - * - * @return void */ public function before(RequestInterface $request, $arguments = null) { + return null; } /** * Add security headers. * * @param list|null $arguments - * - * @return void */ public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { foreach ($this->headers as $header => $value) { $response->setHeader($header, $value); } + + return $response; } } diff --git a/tests/_support/Filters/Customfilter.php b/tests/_support/Filters/Customfilter.php index ac8bce0f0271..7cfb89f60d48 100644 --- a/tests/_support/Filters/Customfilter.php +++ b/tests/_support/Filters/Customfilter.php @@ -26,7 +26,8 @@ public function before(RequestInterface $request, $arguments = null) return $request; } - public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void + public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { + return null; } } diff --git a/tests/_support/Filters/RedirectFilter.php b/tests/_support/Filters/RedirectFilter.php index 8ab62eb665ca..b2e9289d6b6b 100644 --- a/tests/_support/Filters/RedirectFilter.php +++ b/tests/_support/Filters/RedirectFilter.php @@ -24,7 +24,8 @@ public function before(RequestInterface $request, $arguments = null) return redirect()->to('login'); } - public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void + public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { + return null; } } diff --git a/tests/system/Filters/fixtures/GoogleCurious.php b/tests/system/Filters/fixtures/GoogleCurious.php index f00bc065f1d7..6a6871fcc8d4 100644 --- a/tests/system/Filters/fixtures/GoogleCurious.php +++ b/tests/system/Filters/fixtures/GoogleCurious.php @@ -24,7 +24,8 @@ public function before(RequestInterface $request, $arguments = null) return 'This is curious'; } - public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void + public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { + return null; } } diff --git a/tests/system/Filters/fixtures/GoogleEmpty.php b/tests/system/Filters/fixtures/GoogleEmpty.php index 6b0003e8de16..9de00d28f514 100644 --- a/tests/system/Filters/fixtures/GoogleEmpty.php +++ b/tests/system/Filters/fixtures/GoogleEmpty.php @@ -24,7 +24,8 @@ public function before(RequestInterface $request, $arguments = null) return ''; } - public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void + public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { + return null; } } diff --git a/tests/system/Filters/fixtures/GoogleYou.php b/tests/system/Filters/fixtures/GoogleYou.php index 7d2913866b30..5911940b2954 100644 --- a/tests/system/Filters/fixtures/GoogleYou.php +++ b/tests/system/Filters/fixtures/GoogleYou.php @@ -27,7 +27,8 @@ public function before(RequestInterface $request, $arguments = null) return $response; } - public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void + public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { + return null; } } diff --git a/tests/system/Filters/fixtures/Multiple1.php b/tests/system/Filters/fixtures/Multiple1.php index e9f4f49a10ab..6d2cee231808 100644 --- a/tests/system/Filters/fixtures/Multiple1.php +++ b/tests/system/Filters/fixtures/Multiple1.php @@ -26,7 +26,8 @@ public function before(RequestInterface $request, $arguments = null) return $request; } - public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void + public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { + return null; } } diff --git a/tests/system/Filters/fixtures/Multiple2.php b/tests/system/Filters/fixtures/Multiple2.php index 5520ce549930..d86f8fa79399 100644 --- a/tests/system/Filters/fixtures/Multiple2.php +++ b/tests/system/Filters/fixtures/Multiple2.php @@ -26,7 +26,8 @@ public function before(RequestInterface $request, $arguments = null) return $request; } - public function after(RequestInterface $request, ResponseInterface $response, $arguments = null): void + public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { + return null; } }