Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add types for cache handlers #7858

Merged
merged 1 commit into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions system/Cache/Handlers/BaseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions system/Cache/Handlers/DummyHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public function delete(string $key)

/**
* {@inheritDoc}
*
* @return int
*/
public function deleteMatching(string $pattern)
{
Expand Down
2 changes: 2 additions & 0 deletions system/Cache/Handlers/FileHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ public function delete(string $key)

/**
* {@inheritDoc}
*
* @return int
*/
public function deleteMatching(string $pattern)
{
Expand Down
2 changes: 2 additions & 0 deletions system/Cache/Handlers/MemcachedHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ public function delete(string $key)

/**
* {@inheritDoc}
*
* @return never
*/
public function deleteMatching(string $pattern)
{
Expand Down
2 changes: 2 additions & 0 deletions system/Cache/Handlers/PredisHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ public function delete(string $key)

/**
* {@inheritDoc}
*
* @return int
*/
public function deleteMatching(string $pattern)
{
Expand Down
2 changes: 2 additions & 0 deletions system/Cache/Handlers/RedisHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ public function delete(string $key)

/**
* {@inheritDoc}
*
* @return int
*/
public function deleteMatching(string $pattern)
{
Expand Down
2 changes: 2 additions & 0 deletions system/Cache/Handlers/WincacheHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public function delete(string $key)

/**
* {@inheritDoc}
*
* @return never
*/
public function deleteMatching(string $pattern)
{
Expand Down
2 changes: 2 additions & 0 deletions system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down