From 7f822f8abefb5816872833df9366a1491de90794 Mon Sep 17 00:00:00 2001 From: Laurent Legaz Date: Mon, 16 Feb 2026 13:37:54 +0100 Subject: [PATCH 1/2] composer.json updated --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0a240a8..61d08d9 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,8 @@ "phpunit/phpunit": "^10.5", "symfony/var-dumper": "~6.4", "friendsofphp/php-cs-fixer": "~3.3", - "cache/integration-tests": "dev-master" + "cache/integration-tests": "dev-master", + "phpstan/phpstan": "^2.1" }, "suggest": { "ext-redis": "^5.3" From fcedd50b14ec75b0c56ffdc3784566de135b721f Mon Sep 17 00:00:00 2001 From: Laurent Legaz Date: Mon, 16 Feb 2026 15:55:17 +0100 Subject: [PATCH 2/2] feature: PHP Stan 1st pass --- src/CacheEntryPool/CacheEntryPool.php | 2 +- src/RedisEnhancedCache.php | 2 +- tests/Integration/CacheIntegrationTest.php | 2 ++ tests/Integration/CacheIntegrationWithPCTest.php | 2 ++ tests/Integration/PoolIntegrationTest.php | 1 + tests/Integration/PoolIntegrationWithPCTest.php | 1 + 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/CacheEntryPool/CacheEntryPool.php b/src/CacheEntryPool/CacheEntryPool.php index 9f6d675..b8fc41f 100644 --- a/src/CacheEntryPool/CacheEntryPool.php +++ b/src/CacheEntryPool/CacheEntryPool.php @@ -83,7 +83,7 @@ public function clear(): bool $this->cache->delete($this->poolName); unset($this->deferredItems); $this->deferredItems = []; - } catch (Exception $e) { + } catch (\Exception $e) { return false; } diff --git a/src/RedisEnhancedCache.php b/src/RedisEnhancedCache.php index b2959b4..2e01d8b 100644 --- a/src/RedisEnhancedCache.php +++ b/src/RedisEnhancedCache.php @@ -362,7 +362,7 @@ public function deleteFromPool(array $keys, string $pool = self::DEFAULT_POOL): try { $redisResponse = call_user_func_array([$this->getRedis(), 'hdel'], $params); - } catch (Exception $e) { + } catch (\Exception $e) { $redisResponse = false; $this->formatException($e); } diff --git a/tests/Integration/CacheIntegrationTest.php b/tests/Integration/CacheIntegrationTest.php index 0b3199f..73a07cd 100644 --- a/tests/Integration/CacheIntegrationTest.php +++ b/tests/Integration/CacheIntegrationTest.php @@ -7,6 +7,8 @@ use Cache\IntegrationTests\SimpleCacheTest; use LLegaz\Cache\RedisCache as SUT; use LLegaz\Cache\Tests\TestState; +use PHPUnit\Framework\Attributes\Before; +use PHPUnit\Framework\Attributes\DataProvider; use Psr\SimpleCache\CacheInterface; use TypeError; diff --git a/tests/Integration/CacheIntegrationWithPCTest.php b/tests/Integration/CacheIntegrationWithPCTest.php index 65bbde2..b8be434 100644 --- a/tests/Integration/CacheIntegrationWithPCTest.php +++ b/tests/Integration/CacheIntegrationWithPCTest.php @@ -7,6 +7,8 @@ use Cache\IntegrationTests\SimpleCacheTest; use LLegaz\Cache\RedisCache as SUT; use LLegaz\Cache\Tests\TestState; +use PHPUnit\Framework\Attributes\Before; +use PHPUnit\Framework\Attributes\DataProvider; use Psr\SimpleCache\CacheInterface; use TypeError; diff --git a/tests/Integration/PoolIntegrationTest.php b/tests/Integration/PoolIntegrationTest.php index 253ee57..027871f 100644 --- a/tests/Integration/PoolIntegrationTest.php +++ b/tests/Integration/PoolIntegrationTest.php @@ -8,6 +8,7 @@ use LLegaz\Cache\Pool\CacheEntryPool as SUT; use LLegaz\Cache\RedisEnhancedCache; use LLegaz\Cache\Tests\TestState; +use PHPUnit\Framework\Attributes\Before; use Psr\Cache\CacheItemPoolInterface; if (!defined('SKIP_INTEGRATION_TESTS')) { diff --git a/tests/Integration/PoolIntegrationWithPCTest.php b/tests/Integration/PoolIntegrationWithPCTest.php index 5a1f1d3..8dee8c1 100644 --- a/tests/Integration/PoolIntegrationWithPCTest.php +++ b/tests/Integration/PoolIntegrationWithPCTest.php @@ -8,6 +8,7 @@ use LLegaz\Cache\Pool\CacheEntryPool as SUT; use LLegaz\Cache\RedisEnhancedCache; use LLegaz\Cache\Tests\TestState; +use PHPUnit\Framework\Attributes\Before; use Psr\Cache\CacheItemPoolInterface; if (!defined('SKIP_INTEGRATION_TESTS')) {