From 29f349f0591415ba570b276f16d78cf2268333bb Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Fri, 28 Aug 2026 13:45:02 +0800 Subject: [PATCH] refactor: fix remaining missing iterable types --- system/Common.php | 11 +- system/Controller.php | 15 +- system/Cookie/CookieStore.php | 2 + system/Exceptions/PageNotFoundException.php | 2 + system/HotReloader/DirectoryHasher.php | 2 + system/HotReloader/HotReloader.php | 2 + system/HotReloader/IteratorFilter.php | 3 + system/Images/Handlers/BaseHandler.php | 6 + system/Images/Image.php | 2 +- system/Modules/Modules.php | 3 + system/Pager/Pager.php | 25 +- system/Pager/PagerInterface.php | 14 + system/Pager/PagerRenderer.php | 11 +- system/Publisher/ContentReplacer.php | 2 +- system/Publisher/Publisher.php | 2 +- system/Typography/Typography.php | 4 +- system/View/Cell.php | 18 +- tests/system/CLI/CLITest.php | 10 +- tests/system/CodeIgniterTest.php | 6 +- tests/system/CommonFunctionsTest.php | 3 + tests/system/CommonHelperTest.php | 3 + tests/system/Cookie/CookieStoreTest.php | 12 + tests/system/Cookie/CookieTest.php | 24 ++ tests/system/Models/FindModelTest.php | 6 + tests/system/Models/TimestampModelTest.php | 4 + tests/system/Pager/PagerRendererTest.php | 8 +- tests/system/Pager/PagerTest.php | 4 +- .../Publisher/PublisherRestrictionsTest.php | 6 + .../system/RESTful/ResourceControllerTest.php | 3 + tests/system/Throttle/ThrottleTest.php | 10 + utils/phpstan-baseline/loader.neon | 2 +- .../missingType.iterableValue.neon | 287 +----------------- 32 files changed, 182 insertions(+), 330 deletions(-) diff --git a/system/Common.php b/system/Common.php index 32f66d1803ee..226c0554a6cf 100644 --- a/system/Common.php +++ b/system/Common.php @@ -819,6 +819,8 @@ function lang(string $line, array $args = [], ?string $locale = null) * - notice * - info * - debug + * + * @param array $context */ function log_message(string $level, string $message, array $context = []): void { @@ -861,7 +863,7 @@ function model(string $name, bool $getShared = true, ?ConnectionInterface &$conn * @param string|null $default * @param 'attr'|'css'|'html'|'js'|'raw'|'url'|false $escape * - * @return array|string|null + * @return array|string|null */ function old(string $key, $default = null, $escape = 'html') { @@ -1185,7 +1187,7 @@ function slash_item(string $item): ?string * Helper function used to convert a string, array, or object * of attributes to a string. * - * @param array|object|string $attributes string, array, object that can be cast to array + * @param array|object|string $attributes */ function stringify_attributes($attributes, bool $js = false): string { @@ -1252,7 +1254,8 @@ function timer(?string $name = null, ?callable $callable = null) * NOTE: Does not provide any escaping of the data, so that must * all be handled manually by the developer. * - * @param array $options Options for saveData or third-party extensions. + * @param array $data + * @param array $options Options for saveData or third-party extensions. */ function view(string $name, array $data = [], array $options = []): string { @@ -1275,7 +1278,7 @@ function view(string $name, array $data = [], array $options = []): string * View cells are used within views to insert HTML chunks that are managed * by other classes. * - * @param array|string|null $params + * @param array|string|null $params * * @throws ReflectionException */ diff --git a/system/Controller.php b/system/Controller.php index af74f3a3af10..e4516383c08c 100644 --- a/system/Controller.php +++ b/system/Controller.php @@ -126,8 +126,8 @@ protected function cachePage(int $time) /** * A shortcut to performing validation on Request data. * - * @param array|string $rules - * @param array $messages An array of custom error messages + * @param array|string $rules + * @param array|string> $messages An array of custom error messages */ protected function validate($rules, array $messages = []): bool { @@ -139,10 +139,10 @@ protected function validate($rules, array $messages = []): bool /** * A shortcut to performing validation on any input data. * - * @param array $data The data to validate - * @param array|string $rules - * @param array $messages An array of custom error messages - * @param string|null $dbGroup The database group to use + * @param array $data The data to validate + * @param array|string $rules + * @param array|string> $messages An array of custom error messages + * @param string|null $dbGroup The database group to use */ protected function validateData(array $data, $rules, array $messages = [], ?string $dbGroup = null): bool { @@ -152,7 +152,8 @@ protected function validateData(array $data, $rules, array $messages = [], ?stri } /** - * @param array|string $rules + * @param array|string $rules + * @param array|string> $messages */ private function setValidator($rules, array $messages): void { diff --git a/system/Cookie/CookieStore.php b/system/Cookie/CookieStore.php index c4b2994d9cf3..ece407e98d80 100644 --- a/system/Cookie/CookieStore.php +++ b/system/Cookie/CookieStore.php @@ -196,6 +196,8 @@ public function getIterator(): Traversable /** * Validates all cookies passed to be instances of Cookie. * + * @param array $cookies + * * @throws CookieException */ protected function validateCookies(array $cookies): void diff --git a/system/Exceptions/PageNotFoundException.php b/system/Exceptions/PageNotFoundException.php index f84763ec25ff..f3a69745adc9 100644 --- a/system/Exceptions/PageNotFoundException.php +++ b/system/Exceptions/PageNotFoundException.php @@ -72,6 +72,8 @@ public static function forLocaleNotSupported(string $locale) * have the current locale, so even if users call * `$this->request->setLocale()` in the controller afterwards, * the Language locale will not be changed. + * + * @param array $args */ private static function lang(string $line, array $args = []): string { diff --git a/system/HotReloader/DirectoryHasher.php b/system/HotReloader/DirectoryHasher.php index ed82d98b894a..ab9ab7a017a4 100644 --- a/system/HotReloader/DirectoryHasher.php +++ b/system/HotReloader/DirectoryHasher.php @@ -39,6 +39,8 @@ public function hash(): string /** * Generates an array of md5 hashes for all directories that are * watched by the Hot Reloader, as defined in the Config\Toolbar. + * + * @return array */ public function hashApp(): array { diff --git a/system/HotReloader/HotReloader.php b/system/HotReloader/HotReloader.php index 305e641af04e..e1100e898436 100644 --- a/system/HotReloader/HotReloader.php +++ b/system/HotReloader/HotReloader.php @@ -61,6 +61,8 @@ public function run(): void /** * Send an event to the browser. + * + * @param array $data */ private function sendEvent(string $event, array $data): void { diff --git a/system/HotReloader/IteratorFilter.php b/system/HotReloader/IteratorFilter.php index 983e1297a71b..1134f77665f1 100644 --- a/system/HotReloader/IteratorFilter.php +++ b/system/HotReloader/IteratorFilter.php @@ -24,6 +24,9 @@ */ final class IteratorFilter extends RecursiveFilterIterator implements RecursiveIterator { + /** + * @var list + */ private array $watchedExtensions = []; public function __construct(RecursiveIterator $iterator) diff --git a/system/Images/Handlers/BaseHandler.php b/system/Images/Handlers/BaseHandler.php index bc70517a36a6..83535e1f8ad2 100644 --- a/system/Images/Handlers/BaseHandler.php +++ b/system/Images/Handlers/BaseHandler.php @@ -552,6 +552,8 @@ public function fit(int $width, ?int $height = null, string $position = 'center' * @param float|int|null $height * @param float|int $origWidth * @param float|int $origHeight + * + * @return array{0: float|int, 1: float|int} */ protected function calcAspectRatio($width, $height = null, $origWidth = 0, $origHeight = 0): array { @@ -593,6 +595,8 @@ protected function calcAspectRatio($width, $height = null, $origWidth = 0, $orig * @param float|int $origWidth * @param float|int $origHeight * @param string $position + * + * @return array{0: float|int, 1: float|int} */ protected function calcCropCoords($width, $height, $origWidth, $origHeight, $position): array { @@ -684,6 +688,8 @@ abstract protected function process(string $action); * Provide access to the Image class' methods if they don't exist * on the handler itself. * + * @param list $args + * * @return mixed */ public function __call(string $name, array $args = []) diff --git a/system/Images/Image.php b/system/Images/Image.php index 3e0b0ba6876d..e634b914016a 100644 --- a/system/Images/Image.php +++ b/system/Images/Image.php @@ -97,7 +97,7 @@ public function copy(string $targetPath, ?string $targetName = null, int $perms * * A helper function that gets info about the file * - * @return array|bool + * @return array{width: int, height: int, image_type: int, size_str: string, mime_type: string}|bool */ public function getProperties(bool $return = false) { diff --git a/system/Modules/Modules.php b/system/Modules/Modules.php index ca4fe40ab128..4a7ce3ef942c 100644 --- a/system/Modules/Modules.php +++ b/system/Modules/Modules.php @@ -60,6 +60,9 @@ public function shouldDiscover(string $alias): bool return in_array(strtolower($alias), $this->aliases, true); } + /** + * @param array $array + */ public static function __set_state(array $array) { $obj = new static(); diff --git a/system/Pager/Pager.php b/system/Pager/Pager.php index cb151a603a40..4537f1d43db3 100644 --- a/system/Pager/Pager.php +++ b/system/Pager/Pager.php @@ -34,14 +34,23 @@ class Pager implements PagerInterface /** * The group data. * - * @var array + * @var array */ protected $groups = []; /** * URI segment for groups if provided. * - * @var array + * @var array */ protected $segment = []; @@ -272,7 +281,7 @@ public function getPageURI(?int $page = null, string $group = 'default', bool $r $segment = $this->segment[$group] ?? 0; - if ($segment) { + if ($segment !== 0) { $uri->setSegment($segment, $page); } else { $uri->addQuery($this->groups[$group]['pageSelector'], $page); @@ -281,7 +290,7 @@ public function getPageURI(?int $page = null, string $group = 'default', bool $r if ($this->only !== null) { $query = array_intersect_key(service('superglobals')->getGetArray(), array_flip($this->only)); - if (! $segment) { + if ($segment === 0) { $query[$this->groups[$group]['pageSelector']] = $page; } @@ -357,12 +366,6 @@ public function getPerPage(string $group = 'default'): int return (int) $this->groups[$group]['perPage']; } - /** - * Returns an array with details about the results, including - * total, per_page, current_page, last_page, next_url, prev_url, from, to. - * Does not include the actual data. This data is suitable for adding - * a 'data' object to with the result set and converting to JSON. - */ public function getDetails(string $group = 'default'): array { if (! array_key_exists($group, $this->groups)) { @@ -380,6 +383,8 @@ public function getDetails(string $group = 'default'): array /** * Sets only allowed queries on pagination links. + * + * @param list $queries */ public function only(array $queries): self { diff --git a/system/Pager/PagerInterface.php b/system/Pager/PagerInterface.php index 650b04f48e30..bfffd92411a8 100644 --- a/system/Pager/PagerInterface.php +++ b/system/Pager/PagerInterface.php @@ -115,6 +115,20 @@ public function getPerPage(string $group = 'default'): int; * total, per_page, current_page, last_page, next_url, prev_url, from, to. * Does not include the actual data. This data is suitable for adding * a 'data' object to with the result set and converting to JSON. + * + * @return array{ + * currentUri: URI, + * uri: URI, + * hasMore: bool, + * total: int|null, + * perPage: int, + * pageCount: int, + * pageSelector: string, + * currentPage: int, + * next: string|null, + * previous: string|null, + * segment: int + * } */ public function getDetails(string $group = 'default'): array; } diff --git a/system/Pager/PagerRenderer.php b/system/Pager/PagerRenderer.php index f970ee551f19..70959c820ea4 100644 --- a/system/Pager/PagerRenderer.php +++ b/system/Pager/PagerRenderer.php @@ -101,7 +101,16 @@ class PagerRenderer protected ?int $perPageEnd = null; /** - * Constructor. + * @param array{ + * uri: URI, + * pageCount: int, + * currentPage: int, + * total: int|null, + * segment?: int, + * pageSelector?: string, + * perPage?: int|null, + * ... + * } $details */ public function __construct(array $details) { diff --git a/system/Publisher/ContentReplacer.php b/system/Publisher/ContentReplacer.php index 6e8c01fa2e41..b263b1a18d7f 100644 --- a/system/Publisher/ContentReplacer.php +++ b/system/Publisher/ContentReplacer.php @@ -25,7 +25,7 @@ class ContentReplacer /** * Replace content * - * @param array $replaces [search => replace] + * @param array $replaces [search => replace] */ public function replace(string $content, array $replaces): string { diff --git a/system/Publisher/Publisher.php b/system/Publisher/Publisher.php index 8d9f6b72327a..abf414f45c37 100644 --- a/system/Publisher/Publisher.php +++ b/system/Publisher/Publisher.php @@ -413,7 +413,7 @@ final public function merge(bool $replace = true): bool /** * Replace content * - * @param array $replaces [search => replace] + * @param array $replaces [search => replace] */ public function replace(string $file, array $replaces): bool { diff --git a/system/Typography/Typography.php b/system/Typography/Typography.php index 58bb10b0df5a..e2adc4cd5057 100644 --- a/system/Typography/Typography.php +++ b/system/Typography/Typography.php @@ -46,7 +46,7 @@ class Typography /** * array of block level elements that require inner content to be within another block level element * - * @var array + * @var list */ public $innerBlockRequired = ['blockquote']; @@ -316,6 +316,8 @@ protected function formatNewLines(string $str): string * We don't want quotes converted within tags so we'll temporarily convert them to {@DQ} and {@SQ} * and we don't want double dashes converted to emdash entities, so they are marked with {@DD} * likewise double spaces are converted to {@NBS} to prevent entity conversion + * + * @param array $match */ protected function protectCharacters(array $match): string { diff --git a/system/View/Cell.php b/system/View/Cell.php index 5e0eda26255b..7b0a15853b2f 100644 --- a/system/View/Cell.php +++ b/system/View/Cell.php @@ -67,10 +67,10 @@ public function __construct(CacheInterface $cache) /** * Render a cell, returning its body as a string. * - * @param string $library Cell class and method name. - * @param array|string|null $params Parameters to pass to the method. - * @param int $ttl Number of seconds to cache the cell. - * @param string|null $cacheName Cache item name. + * @param string $library Cell class and method name. + * @param array|string|null $params Parameters to pass to the method. + * @param int $ttl Number of seconds to cache the cell. + * @param string|null $cacheName Cache item name. * * @throws ReflectionException */ @@ -116,9 +116,9 @@ public function render(string $library, $params = null, int $ttl = 0, ?string $c * If a string, it should be in the format "key1=value key2=value". * It will be split and returned as an array. * - * @param array|float|string|null $params + * @param array|float|string|null $params * - * @return array + * @return array */ public function prepareParams($params) { @@ -199,7 +199,7 @@ protected function determineClass(string $library): array /** * Renders a cell that extends the BaseCell class. * - * @param array $params + * @param array $params */ final protected function renderCell(BaseCell $instance, string $method, array $params): string { @@ -237,7 +237,7 @@ final protected function renderCell(BaseCell $instance, string $method, array $p * for a method, in the order they are defined. This allows * them to be passed directly into the method. * - * @param array $params + * @param array $params * * @return list */ @@ -268,7 +268,7 @@ private function getMethodParams(BaseCell $instance, string $method, array $para * * @todo Determine if this can be refactored to use $this-getMethodParams(). * - * @param array $params + * @param array $params */ final protected function renderSimpleClass(object $instance, string $method, array $params, string $class): string { diff --git a/tests/system/CLI/CLITest.php b/tests/system/CLI/CLITest.php index 083f8792e31a..052fbd602aea 100644 --- a/tests/system/CLI/CLITest.php +++ b/tests/system/CLI/CLITest.php @@ -649,18 +649,20 @@ private function captureGenerateDimensionsStderr(?array $env = null): string } /** - * @param array $tbody - * @param array $thead - * @param array $expected + * @param list> $tbody + * @param list $thead */ #[DataProvider('provideTable')] - public function testTable($tbody, $thead, $expected): void + public function testTable(array $tbody, array $thead, string $expected): void { CLI::table($tbody, $thead); $this->assertSame($this->getStreamFilterBuffer(), $expected); } + /** + * @return iterable>, list, string}> + */ public static function provideTable(): iterable { $head = [ diff --git a/tests/system/CodeIgniterTest.php b/tests/system/CodeIgniterTest.php index 2d621f3b8703..0c7c8d2e64d0 100644 --- a/tests/system/CodeIgniterTest.php +++ b/tests/system/CodeIgniterTest.php @@ -834,7 +834,8 @@ public function testPageCacheSendSecureHeaders(): void } /** - * @param array|bool $cacheQueryStringValue + * @param bool|list $cacheQueryStringValue + * @param list $testingUrls * * @see https://github.com/codeigniter4/CodeIgniter4/pull/6410 */ @@ -905,6 +906,9 @@ public function testPageCacheWithCacheQueryString( CITestStreamFilter::removeErrorFilter(); } + /** + * @return iterable, int, list}> + */ public static function providePageCacheWithCacheQueryString(): iterable { $testingUrls = [ diff --git a/tests/system/CommonFunctionsTest.php b/tests/system/CommonFunctionsTest.php index 3f970d72a154..b4901a5e8d93 100644 --- a/tests/system/CommonFunctionsTest.php +++ b/tests/system/CommonFunctionsTest.php @@ -743,6 +743,9 @@ public function testCleanPathActuallyCleaningThePaths($input, $expected): void $this->assertSame($expected, clean_path($input)); } + /** + * @return iterable + */ public static function provideCleanPathActuallyCleaningThePaths(): iterable { $ds = DIRECTORY_SEPARATOR; diff --git a/tests/system/CommonHelperTest.php b/tests/system/CommonHelperTest.php index 71d5bdb8c14e..641f56dc8ec4 100644 --- a/tests/system/CommonHelperTest.php +++ b/tests/system/CommonHelperTest.php @@ -31,6 +31,9 @@ #[Group('Others')] final class CommonHelperTest extends CIUnitTestCase { + /** + * @var list + */ private array $dummyHelpers = [ APPPATH . 'Helpers' . DIRECTORY_SEPARATOR . 'foobarbaz_helper.php', SYSTEMPATH . 'Helpers' . DIRECTORY_SEPARATOR . 'foobarbaz_helper.php', diff --git a/tests/system/Cookie/CookieStoreTest.php b/tests/system/Cookie/CookieStoreTest.php index 60498052ee93..2b8fb9c5032c 100644 --- a/tests/system/Cookie/CookieStoreTest.php +++ b/tests/system/Cookie/CookieStoreTest.php @@ -24,6 +24,18 @@ #[Group('Others')] final class CookieStoreTest extends CIUnitTestCase { + /** + * @var array{ + * prefix: string, + * expires: int, + * path: string, + * domain: string, + * secure: bool, + * httponly: bool, + * samesite: string, + * raw: bool + * } + */ private array $defaults; protected function setUp(): void diff --git a/tests/system/Cookie/CookieTest.php b/tests/system/Cookie/CookieTest.php index 542ff096d0ce..cade48b24f52 100644 --- a/tests/system/Cookie/CookieTest.php +++ b/tests/system/Cookie/CookieTest.php @@ -28,6 +28,18 @@ #[Group('Others')] final class CookieTest extends CIUnitTestCase { + /** + * @var array{ + * prefix: string, + * expires: int, + * path: string, + * domain: string, + * secure: bool, + * httponly: bool, + * samesite: string, + * raw: bool + * } + */ private array $defaults; protected function setUp(): void @@ -99,6 +111,9 @@ public function testConfigPrefix(string $configPrefix, string $optionPrefix, str $this->assertSame($expected, $cookie->getPrefixedName()); } + /** + * @return iterable + */ public static function provideConfigPrefix(): iterable { yield from [ @@ -175,6 +190,9 @@ public function testInvalidExpires($expires): void new Cookie('test', 'value', ['expires' => $expires]); } + /** + * @return iterable + */ public static function provideInvalidExpires(): iterable { $cases = [ @@ -188,6 +206,9 @@ public static function provideInvalidExpires(): iterable } } + /** + * @param array $changed + */ #[DataProvider('provideSetCookieHeaderCreation')] public function testSetCookieHeaderCreation(string $header, array $changed): void { @@ -196,6 +217,9 @@ public function testSetCookieHeaderCreation(string $header, array $changed): voi $this->assertSame(array_merge($cookie, $changed), $cookie); } + /** + * @return iterable}> + */ public static function provideSetCookieHeaderCreation(): iterable { yield 'basic' => [ diff --git a/tests/system/Models/FindModelTest.php b/tests/system/Models/FindModelTest.php index b5efc8a64f64..41937bb22bf7 100644 --- a/tests/system/Models/FindModelTest.php +++ b/tests/system/Models/FindModelTest.php @@ -207,6 +207,9 @@ public function testFirstAggregate($groupBy, $total): void $this->assertSame($total, (int) $user->total); } + /** + * @return iterable + */ public static function provideFirstAggregate(): iterable { return [ @@ -293,6 +296,9 @@ public function testFirstRecoverTempUseSoftDeletes($aggregate, $groupBy): void $this->assertSame(2, (int) $user2->id); } + /** + * @return iterable + */ public static function provideAggregateAndGroupBy(): iterable { return [ diff --git a/tests/system/Models/TimestampModelTest.php b/tests/system/Models/TimestampModelTest.php index 52989cff754a..f87f54772831 100644 --- a/tests/system/Models/TimestampModelTest.php +++ b/tests/system/Models/TimestampModelTest.php @@ -39,6 +39,8 @@ protected function tearDown(): void } /** + * @param array $data + * * @return int|string Insert ID */ private function allowDatesPrepareOneRecord(array $data): int|string @@ -59,6 +61,8 @@ private function allowDatesPrepareOneRecord(array $data): int|string } /** + * @param array $data + * * @return int|string Insert ID */ private function doNotAllowDatesPrepareOneRecord(array $data): int|string diff --git a/tests/system/Pager/PagerRendererTest.php b/tests/system/Pager/PagerRendererTest.php index d06a040a7925..6744c2522ab9 100644 --- a/tests/system/Pager/PagerRendererTest.php +++ b/tests/system/Pager/PagerRendererTest.php @@ -622,7 +622,7 @@ public function testGetNextPageNumberNull(): void } /** - * @param array> $details + * @param array{uri: URI, pageCount: int, total: int, currentPage: int, perPage: int} $details */ #[DataProvider('providePageStartEnd')] public function testPageStartEnd(array $details, int $pageStart, int $pageEnd): void @@ -635,7 +635,11 @@ public function testPageStartEnd(array $details, int $pageStart, int $pageEnd): } /** - * @return array> $details + * @return iterable */ public static function providePageStartEnd(): iterable { diff --git a/tests/system/Pager/PagerTest.php b/tests/system/Pager/PagerTest.php index b1ab5d7dc4cd..875f5c25b320 100644 --- a/tests/system/Pager/PagerTest.php +++ b/tests/system/Pager/PagerTest.php @@ -76,7 +76,9 @@ public function testSetPathRemembersPath(): void $details = $this->pager->getDetails(); - $this->assertSame('foo/bar', $details['uri']->getRoutePath()); + $uri = $details['uri']; + $this->assertInstanceOf(SiteURI::class, $uri); + $this->assertSame('foo/bar', $uri->getRoutePath()); } public function testGetDetailsRecognizesPageQueryVar(): void diff --git a/tests/system/Publisher/PublisherRestrictionsTest.php b/tests/system/Publisher/PublisherRestrictionsTest.php index eaa326ee82eb..93fcb499faa1 100644 --- a/tests/system/Publisher/PublisherRestrictionsTest.php +++ b/tests/system/Publisher/PublisherRestrictionsTest.php @@ -70,6 +70,9 @@ public function testDefaultPublicRestrictions(string $path): void $this->assertSame($expected, $errors[$file]->getMessage()); } + /** + * @return iterable + */ public static function provideDefaultPublicRestrictions(): iterable { yield from [ @@ -98,6 +101,9 @@ public function testDestinations(string $destination, bool $allowed): void $this->assertInstanceOf(Publisher::class, $publisher); } + /** + * @return iterable + */ public static function provideDestinations(): iterable { return [ diff --git a/tests/system/RESTful/ResourceControllerTest.php b/tests/system/RESTful/ResourceControllerTest.php index c51e4ae39174..2fe864736c05 100644 --- a/tests/system/RESTful/ResourceControllerTest.php +++ b/tests/system/RESTful/ResourceControllerTest.php @@ -370,6 +370,9 @@ public function testXMLFormatOutput(): void $this->assertSame($expected, $result); } + /** + * @param list $args + */ private function invoke(object $controller, string $method, array $args = []): object { $method = self::getPrivateMethodInvoker($controller, $method); diff --git a/tests/system/Throttle/ThrottleTest.php b/tests/system/Throttle/ThrottleTest.php index 655cc21dfcfa..98751a86781b 100644 --- a/tests/system/Throttle/ThrottleTest.php +++ b/tests/system/Throttle/ThrottleTest.php @@ -191,6 +191,9 @@ public function testFlooding(): void $this->assertEqualsWithDelta(10.0, round($this->cache->get('throttler_127.0.0.1')), PHP_FLOAT_EPSILON); } + /** + * @param list $checkInputs + */ #[DataProvider('provideTokenTimeCalculationUCs')] public function testTokenTimeCalculationUCs(int $capacity, int $seconds, array $checkInputs): void { @@ -209,6 +212,13 @@ public function testTokenTimeCalculationUCs(int $capacity, int $seconds, array $ } } + /** + * @return iterable + * }> + */ public static function provideTokenTimeCalculationUCs(): iterable { return [ diff --git a/utils/phpstan-baseline/loader.neon b/utils/phpstan-baseline/loader.neon index e796bfe1763f..999a75fe8d95 100644 --- a/utils/phpstan-baseline/loader.neon +++ b/utils/phpstan-baseline/loader.neon @@ -1,4 +1,4 @@ -# total 99 errors +# total 42 errors includes: - argument.type.neon diff --git a/utils/phpstan-baseline/missingType.iterableValue.neon b/utils/phpstan-baseline/missingType.iterableValue.neon index de7951be1665..43333c3fa6f6 100644 --- a/utils/phpstan-baseline/missingType.iterableValue.neon +++ b/utils/phpstan-baseline/missingType.iterableValue.neon @@ -1,293 +1,8 @@ -# total 58 errors +# total 1 error parameters: ignoreErrors: - - - message: '#^Function log_message\(\) has parameter \$context with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Common.php - - - - message: '#^Function old\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Common.php - - - - message: '#^Function stringify_attributes\(\) has parameter \$attributes with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Common.php - - - - message: '#^Function view\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Common.php - - - - message: '#^Function view\(\) has parameter \$options with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Common.php - - - - message: '#^Function view_cell\(\) has parameter \$params with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Common.php - - - - message: '#^Method CodeIgniter\\Controller\:\:setValidator\(\) has parameter \$messages with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Controller.php - - - - message: '#^Method CodeIgniter\\Controller\:\:setValidator\(\) has parameter \$rules with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Controller.php - - - - message: '#^Method CodeIgniter\\Controller\:\:validateData\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Controller.php - - - - message: '#^Method CodeIgniter\\Controller\:\:validateData\(\) has parameter \$messages with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Controller.php - - - - message: '#^Method CodeIgniter\\Controller\:\:validateData\(\) has parameter \$rules with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Controller.php - - - - message: '#^Method CodeIgniter\\Controller\:\:validate\(\) has parameter \$messages with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Controller.php - - - - message: '#^Method CodeIgniter\\Controller\:\:validate\(\) has parameter \$rules with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Controller.php - - - - message: '#^Method CodeIgniter\\Cookie\\CookieStore\:\:validateCookies\(\) has parameter \$cookies with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Cookie/CookieStore.php - - - - message: '#^Method CodeIgniter\\Exceptions\\PageNotFoundException\:\:lang\(\) has parameter \$args with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Exceptions/PageNotFoundException.php - - - - message: '#^Method CodeIgniter\\HotReloader\\DirectoryHasher\:\:hashApp\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/HotReloader/DirectoryHasher.php - - - - message: '#^Method CodeIgniter\\HotReloader\\HotReloader\:\:sendEvent\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/HotReloader/HotReloader.php - - - - message: '#^Property CodeIgniter\\HotReloader\\IteratorFilter\:\:\$watchedExtensions type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/HotReloader/IteratorFilter.php - - - - message: '#^Method CodeIgniter\\Images\\Handlers\\BaseHandler\:\:__call\(\) has parameter \$args with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Images/Handlers/BaseHandler.php - - - - message: '#^Method CodeIgniter\\Images\\Handlers\\BaseHandler\:\:calcAspectRatio\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Images/Handlers/BaseHandler.php - - - - message: '#^Method CodeIgniter\\Images\\Handlers\\BaseHandler\:\:calcCropCoords\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Images/Handlers/BaseHandler.php - - - - message: '#^Method CodeIgniter\\Images\\Image\:\:getProperties\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Images/Image.php - - - - message: '#^Method CodeIgniter\\Modules\\Modules\:\:__set_state\(\) has parameter \$array with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Modules/Modules.php - - - - message: '#^Method CodeIgniter\\Pager\\Pager\:\:getDetails\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Pager/Pager.php - - - - message: '#^Method CodeIgniter\\Pager\\Pager\:\:only\(\) has parameter \$queries with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Pager/Pager.php - - - - message: '#^Property CodeIgniter\\Pager\\Pager\:\:\$groups type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Pager/Pager.php - - - - message: '#^Property CodeIgniter\\Pager\\Pager\:\:\$segment type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Pager/Pager.php - - - - message: '#^Method CodeIgniter\\Pager\\PagerInterface\:\:getDetails\(\) return type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Pager/PagerInterface.php - - - - message: '#^Method CodeIgniter\\Pager\\PagerRenderer\:\:__construct\(\) has parameter \$details with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Pager/PagerRenderer.php - - - - message: '#^Method CodeIgniter\\Publisher\\ContentReplacer\:\:replace\(\) has parameter \$replaces with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Publisher/ContentReplacer.php - - - - message: '#^Method CodeIgniter\\Publisher\\Publisher\:\:replace\(\) has parameter \$replaces with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Publisher/Publisher.php - - - - message: '#^Method CodeIgniter\\Typography\\Typography\:\:protectCharacters\(\) has parameter \$match with no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Typography/Typography.php - - - - message: '#^Property CodeIgniter\\Typography\\Typography\:\:\$innerBlockRequired type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../system/Typography/Typography.php - - message: '#^Method class@anonymous/system/Traits/PropertiesTrait\.php\:51\:\:getProperties\(\) return type has no value type specified in iterable type array\.$#' count: 1 path: ../../system/View/Cells/Cell.php - - - - message: '#^Method CodeIgniter\\CLI\\CLITest\:\:provideTable\(\) return type has no value type specified in iterable type iterable\.$#' - count: 1 - path: ../../tests/system/CLI/CLITest.php - - - - message: '#^Method CodeIgniter\\CLI\\CLITest\:\:testTable\(\) has parameter \$expected with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/system/CLI/CLITest.php - - - - message: '#^Method CodeIgniter\\CLI\\CLITest\:\:testTable\(\) has parameter \$tbody with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/system/CLI/CLITest.php - - - - message: '#^Method CodeIgniter\\CLI\\CLITest\:\:testTable\(\) has parameter \$thead with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/system/CLI/CLITest.php - - - - message: '#^Method CodeIgniter\\CodeIgniterTest\:\:providePageCacheWithCacheQueryString\(\) return type has no value type specified in iterable type iterable\.$#' - count: 1 - path: ../../tests/system/CodeIgniterTest.php - - - - message: '#^Method CodeIgniter\\CodeIgniterTest\:\:testPageCacheWithCacheQueryString\(\) has parameter \$cacheQueryStringValue with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/system/CodeIgniterTest.php - - - - message: '#^Method CodeIgniter\\CodeIgniterTest\:\:testPageCacheWithCacheQueryString\(\) has parameter \$testingUrls with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/system/CodeIgniterTest.php - - - - message: '#^Method CodeIgniter\\CommonFunctionsTest\:\:provideCleanPathActuallyCleaningThePaths\(\) return type has no value type specified in iterable type iterable\.$#' - count: 1 - path: ../../tests/system/CommonFunctionsTest.php - - - - message: '#^Property CodeIgniter\\CommonHelperTest\:\:\$dummyHelpers type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/system/CommonHelperTest.php - - - - message: '#^Property CodeIgniter\\Cookie\\CookieStoreTest\:\:\$defaults type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/system/Cookie/CookieStoreTest.php - - - - message: '#^Method CodeIgniter\\Cookie\\CookieTest\:\:provideConfigPrefix\(\) return type has no value type specified in iterable type iterable\.$#' - count: 1 - path: ../../tests/system/Cookie/CookieTest.php - - - - message: '#^Method CodeIgniter\\Cookie\\CookieTest\:\:provideInvalidExpires\(\) return type has no value type specified in iterable type iterable\.$#' - count: 1 - path: ../../tests/system/Cookie/CookieTest.php - - - - message: '#^Method CodeIgniter\\Cookie\\CookieTest\:\:provideSetCookieHeaderCreation\(\) return type has no value type specified in iterable type iterable\.$#' - count: 1 - path: ../../tests/system/Cookie/CookieTest.php - - - - message: '#^Method CodeIgniter\\Cookie\\CookieTest\:\:testSetCookieHeaderCreation\(\) has parameter \$changed with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/system/Cookie/CookieTest.php - - - - message: '#^Property CodeIgniter\\Cookie\\CookieTest\:\:\$defaults type has no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/system/Cookie/CookieTest.php - - - - message: '#^Method CodeIgniter\\Models\\FindModelTest\:\:provideAggregateAndGroupBy\(\) return type has no value type specified in iterable type iterable\.$#' - count: 1 - path: ../../tests/system/Models/FindModelTest.php - - - - message: '#^Method CodeIgniter\\Models\\FindModelTest\:\:provideFirstAggregate\(\) return type has no value type specified in iterable type iterable\.$#' - count: 1 - path: ../../tests/system/Models/FindModelTest.php - - - - message: '#^Method CodeIgniter\\Models\\TimestampModelTest\:\:allowDatesPrepareOneRecord\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/system/Models/TimestampModelTest.php - - - - message: '#^Method CodeIgniter\\Models\\TimestampModelTest\:\:doNotAllowDatesPrepareOneRecord\(\) has parameter \$data with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/system/Models/TimestampModelTest.php - - - - message: '#^Method CodeIgniter\\Publisher\\PublisherRestrictionsTest\:\:provideDefaultPublicRestrictions\(\) return type has no value type specified in iterable type iterable\.$#' - count: 1 - path: ../../tests/system/Publisher/PublisherRestrictionsTest.php - - - - message: '#^Method CodeIgniter\\Publisher\\PublisherRestrictionsTest\:\:provideDestinations\(\) return type has no value type specified in iterable type iterable\.$#' - count: 1 - path: ../../tests/system/Publisher/PublisherRestrictionsTest.php - - - - message: '#^Method CodeIgniter\\RESTful\\ResourceControllerTest\:\:invoke\(\) has parameter \$args with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/system/RESTful/ResourceControllerTest.php - - - - message: '#^Method CodeIgniter\\Throttle\\ThrottleTest\:\:provideTokenTimeCalculationUCs\(\) return type has no value type specified in iterable type iterable\.$#' - count: 1 - path: ../../tests/system/Throttle/ThrottleTest.php - - - - message: '#^Method CodeIgniter\\Throttle\\ThrottleTest\:\:testTokenTimeCalculationUCs\(\) has parameter \$checkInputs with no value type specified in iterable type array\.$#' - count: 1 - path: ../../tests/system/Throttle/ThrottleTest.php