From 6bde439429bffc1dca351e1931a6f7e4b8f91656 Mon Sep 17 00:00:00 2001 From: kenjis Date: Sat, 23 Mar 2024 21:25:27 +0900 Subject: [PATCH] docs: fix PHPDoc types for Filters --- phpstan-baseline.php | 60 ------------------- system/Filters/CSRF.php | 4 +- system/Filters/DebugToolbar.php | 4 +- system/Filters/FilterInterface.php | 4 +- system/Filters/Filters.php | 2 +- system/Filters/Honeypot.php | 4 +- system/Filters/InvalidChars.php | 4 +- system/Filters/SecureHeaders.php | 4 +- .../source/libraries/throttler/002.php | 8 +-- 9 files changed, 17 insertions(+), 77 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 7dfbce9094a9..a277f7a5acf3 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -5766,36 +5766,6 @@ 'count' => 3, 'path' => __DIR__ . '/system/Files/File.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Filters\\\\CSRF\\:\\:after\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Filters/CSRF.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Filters\\\\CSRF\\:\\:before\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Filters/CSRF.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Filters\\\\DebugToolbar\\:\\:after\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Filters/DebugToolbar.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Filters\\\\DebugToolbar\\:\\:before\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Filters/DebugToolbar.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Filters\\\\FilterInterface\\:\\:after\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Filters/FilterInterface.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Filters\\\\FilterInterface\\:\\:before\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Filters/FilterInterface.php', -]; $ignoreErrors[] = [ 'message' => '#^Argument \\#1 \\$name \\(\'Config\\\\\\\\Modules\'\\) passed to function config does not extend CodeIgniter\\\\\\\\Config\\\\\\\\BaseConfig\\.$#', 'count' => 1, @@ -5861,26 +5831,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Filters/Filters.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Filters\\\\Honeypot\\:\\:after\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Filters/Honeypot.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Filters\\\\Honeypot\\:\\:before\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Filters/Honeypot.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Filters\\\\InvalidChars\\:\\:after\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Filters/InvalidChars.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Filters\\\\InvalidChars\\:\\:before\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Filters/InvalidChars.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Filters\\\\InvalidChars\\:\\:checkControl\\(\\) has parameter \\$value with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -5901,16 +5851,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Filters/InvalidChars.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Filters\\\\SecureHeaders\\:\\:after\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Filters/SecureHeaders.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Filters\\\\SecureHeaders\\:\\:before\\(\\) has parameter \\$arguments with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Filters/SecureHeaders.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Format\\\\FormatterInterface\\:\\:format\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#', 'count' => 1, diff --git a/system/Filters/CSRF.php b/system/Filters/CSRF.php index 23e6e2540eca..5145b5b089c6 100644 --- a/system/Filters/CSRF.php +++ b/system/Filters/CSRF.php @@ -38,7 +38,7 @@ class CSRF implements FilterInterface * sent back to the client, allowing for error pages, * redirects, etc. * - * @param array|null $arguments + * @param list|null $arguments * * @return RedirectResponse|void * @@ -66,7 +66,7 @@ public function before(RequestInterface $request, $arguments = null) /** * We don't have anything to do here. * - * @param array|null $arguments + * @param list|null $arguments * * @return void */ diff --git a/system/Filters/DebugToolbar.php b/system/Filters/DebugToolbar.php index 75662d841ade..b05a92b6640e 100644 --- a/system/Filters/DebugToolbar.php +++ b/system/Filters/DebugToolbar.php @@ -25,7 +25,7 @@ class DebugToolbar implements FilterInterface /** * We don't need to do anything here. * - * @param array|null $arguments + * @param list|null $arguments */ public function before(RequestInterface $request, $arguments = null) { @@ -35,7 +35,7 @@ public function before(RequestInterface $request, $arguments = null) * If the debug flag is set (CI_DEBUG) then collect performance * and debug information and display it in a toolbar. * - * @param array|null $arguments + * @param list|null $arguments */ public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { diff --git a/system/Filters/FilterInterface.php b/system/Filters/FilterInterface.php index 1a3363c90866..4efa781b6201 100644 --- a/system/Filters/FilterInterface.php +++ b/system/Filters/FilterInterface.php @@ -29,7 +29,7 @@ interface FilterInterface * sent back to the client, allowing for error pages, * redirects, etc. * - * @param array|null $arguments + * @param list|null $arguments * * @return RequestInterface|ResponseInterface|string|void */ @@ -41,7 +41,7 @@ public function before(RequestInterface $request, $arguments = null); * to stop execution of other after filters, short of * throwing an Exception or Error. * - * @param array|null $arguments + * @param list|null $arguments * * @return ResponseInterface|void */ diff --git a/system/Filters/Filters.php b/system/Filters/Filters.php index 18001b103844..e7cabc87435d 100644 --- a/system/Filters/Filters.php +++ b/system/Filters/Filters.php @@ -94,7 +94,7 @@ class Filters /** * Any arguments to be passed to filtersClass. * - * @var array>|null> [classname => arguments] + * @var array|null> [classname => arguments] */ protected $argumentsClass = []; diff --git a/system/Filters/Honeypot.php b/system/Filters/Honeypot.php index e30e90f8d9fd..bd2dbf44920e 100644 --- a/system/Filters/Honeypot.php +++ b/system/Filters/Honeypot.php @@ -28,7 +28,7 @@ class Honeypot implements FilterInterface * Checks if Honeypot field is empty, if not then the * requester is a bot * - * @param array|null $arguments + * @param list|null $arguments * * @throws HoneypotException */ @@ -46,7 +46,7 @@ public function before(RequestInterface $request, $arguments = null) /** * Attach a honeypot to the current response. * - * @param array|null $arguments + * @param list|null $arguments */ public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { diff --git a/system/Filters/InvalidChars.php b/system/Filters/InvalidChars.php index 93124fdb4e9f..5528c880369e 100644 --- a/system/Filters/InvalidChars.php +++ b/system/Filters/InvalidChars.php @@ -45,7 +45,7 @@ class InvalidChars implements FilterInterface /** * Check invalid characters. * - * @param array|null $arguments + * @param list|null $arguments * * @return void */ @@ -72,7 +72,7 @@ public function before(RequestInterface $request, $arguments = null) /** * We don't have anything to do here. * - * @param array|null $arguments + * @param list|null $arguments * * @return void */ diff --git a/system/Filters/SecureHeaders.php b/system/Filters/SecureHeaders.php index 952926b95714..cf557069193e 100644 --- a/system/Filters/SecureHeaders.php +++ b/system/Filters/SecureHeaders.php @@ -49,7 +49,7 @@ class SecureHeaders implements FilterInterface /** * We don't have anything to do here. * - * @param array|null $arguments + * @param list|null $arguments * * @return void */ @@ -60,7 +60,7 @@ public function before(RequestInterface $request, $arguments = null) /** * Add security headers. * - * @param array|null $arguments + * @param list|null $arguments * * @return void */ diff --git a/user_guide_src/source/libraries/throttler/002.php b/user_guide_src/source/libraries/throttler/002.php index 91c89ca83d97..440ad582245b 100644 --- a/user_guide_src/source/libraries/throttler/002.php +++ b/user_guide_src/source/libraries/throttler/002.php @@ -13,9 +13,9 @@ class Throttle implements FilterInterface * This is a demo implementation of using the Throttler class * to implement rate limiting for your application. * - * @param array|null $arguments + * @param list|null $arguments * - * @return mixed + * @return ResponseInterface|void */ public function before(RequestInterface $request, $arguments = null) { @@ -31,9 +31,9 @@ public function before(RequestInterface $request, $arguments = null) /** * We don't have anything to do here. * - * @param array|null $arguments + * @param list|null $arguments * - * @return mixed + * @return void */ public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) {