diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 9dea6edd8884..ec5d6987990e 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -16,61 +16,11 @@ 'count' => 1, 'path' => __DIR__ . '/system/BaseModel.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\BaseHandler\\:\\:deleteMatching\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Cache/Handlers/BaseHandler.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\BaseHandler\\:\\:remember\\(\\) has parameter \\$callback with no signature specified for Closure\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Cache/Handlers/BaseHandler.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\DummyHandler\\:\\:deleteMatching\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Cache/Handlers/DummyHandler.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\DummyHandler\\:\\:remember\\(\\) has parameter \\$callback with no signature specified for Closure\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Cache/Handlers/DummyHandler.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\FileHandler\\:\\:deleteMatching\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Cache/Handlers/FileHandler.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\MemcachedHandler\\:\\:deleteMatching\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Cache/Handlers/MemcachedHandler.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\PredisHandler\\:\\:deleteMatching\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Cache/Handlers/PredisHandler.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\RedisHandler\\:\\:deleteMatching\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Cache/Handlers/RedisHandler.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Cache\\\\Handlers\\\\WincacheHandler\\:\\:deleteMatching\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Cache/Handlers/WincacheHandler.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:bootstrapEnvironment\\(\\) has no return type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/CodeIgniter.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:cache\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/CodeIgniter.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\CodeIgniter\\:\\:callExit\\(\\) has no return type specified\\.$#', 'count' => 1, @@ -1436,11 +1386,6 @@ 'count' => 1, 'path' => __DIR__ . '/system/Test/Mock/MockCache.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCache\\:\\:remember\\(\\) has parameter \\$callback with no signature specified for Closure\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/Test/Mock/MockCache.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\Test\\\\Mock\\\\MockCodeIgniter\\:\\:callExit\\(\\) has no return type specified\\.$#', 'count' => 1, diff --git a/system/Cache/Handlers/BaseHandler.php b/system/Cache/Handlers/BaseHandler.php index 9f700370fc8a..74a4482cd4d9 100644 --- a/system/Cache/Handlers/BaseHandler.php +++ b/system/Cache/Handlers/BaseHandler.php @@ -77,6 +77,7 @@ public static function validateKey($key, $prefix = ''): string * @param string $key Cache item name * @param int $ttl Time to live * @param Closure $callback Callback return value + * @phpstan-param Closure(): mixed $callback * * @return array|bool|float|int|object|string|null */ @@ -98,6 +99,8 @@ public function remember(string $key, int $ttl, Closure $callback) * * @param string $pattern Cache items glob-style pattern * + * @return int|never + * * @throws Exception */ public function deleteMatching(string $pattern) diff --git a/system/Cache/Handlers/DummyHandler.php b/system/Cache/Handlers/DummyHandler.php index fd4f1b503111..4349db4f39a5 100644 --- a/system/Cache/Handlers/DummyHandler.php +++ b/system/Cache/Handlers/DummyHandler.php @@ -59,6 +59,8 @@ public function delete(string $key) /** * {@inheritDoc} + * + * @return int */ public function deleteMatching(string $pattern) { diff --git a/system/Cache/Handlers/FileHandler.php b/system/Cache/Handlers/FileHandler.php index 524ee8e47720..aea0a605c47f 100644 --- a/system/Cache/Handlers/FileHandler.php +++ b/system/Cache/Handlers/FileHandler.php @@ -127,6 +127,8 @@ public function delete(string $key) /** * {@inheritDoc} + * + * @return int */ public function deleteMatching(string $pattern) { diff --git a/system/Cache/Handlers/MemcachedHandler.php b/system/Cache/Handlers/MemcachedHandler.php index f38a541113a1..a998ad30386f 100644 --- a/system/Cache/Handlers/MemcachedHandler.php +++ b/system/Cache/Handlers/MemcachedHandler.php @@ -188,6 +188,8 @@ public function delete(string $key) /** * {@inheritDoc} + * + * @return never */ public function deleteMatching(string $pattern) { diff --git a/system/Cache/Handlers/PredisHandler.php b/system/Cache/Handlers/PredisHandler.php index ab4fb1ff0a46..e549a7422c91 100644 --- a/system/Cache/Handlers/PredisHandler.php +++ b/system/Cache/Handlers/PredisHandler.php @@ -150,6 +150,8 @@ public function delete(string $key) /** * {@inheritDoc} + * + * @return int */ public function deleteMatching(string $pattern) { diff --git a/system/Cache/Handlers/RedisHandler.php b/system/Cache/Handlers/RedisHandler.php index adb9a581a75a..d86d9f980d41 100644 --- a/system/Cache/Handlers/RedisHandler.php +++ b/system/Cache/Handlers/RedisHandler.php @@ -176,6 +176,8 @@ public function delete(string $key) /** * {@inheritDoc} + * + * @return int */ public function deleteMatching(string $pattern) { diff --git a/system/Cache/Handlers/WincacheHandler.php b/system/Cache/Handlers/WincacheHandler.php index c5f0f08467e9..b1ea45ded7a2 100644 --- a/system/Cache/Handlers/WincacheHandler.php +++ b/system/Cache/Handlers/WincacheHandler.php @@ -73,6 +73,8 @@ public function delete(string $key) /** * {@inheritDoc} + * + * @return never */ public function deleteMatching(string $pattern) { diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index cc6d3f67de0a..8308dab116cb 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -701,6 +701,8 @@ public function displayCache(Cache $config) * Tells the app that the final output should be cached. * * @deprecated 4.4.0 Moved to ResponseCache::setTtl(). to No longer used. + * + * @return void */ public static function cache(int $time) {