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" 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')) {