From 3c6de55a709682b7a048610df2f204b71710ebfb Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Thu, 26 Jun 2025 16:57:48 -0400 Subject: [PATCH 1/4] Update to PSR Simple Cache v2 and v3 --- composer.json | 2 +- src/SimpleCacheAdapter.php | 20 +++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index fda35df..46a24d2 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "require": { "php": ">=8.0.0", "psr/log": "^1.0 || ^2.0 || ^3.0", - "psr/simple-cache": "^1.0", + "psr/simple-cache": "^2.0 || ^3.0", "cheprasov/php-redis-client": "^1.10" }, "require-dev": { diff --git a/src/SimpleCacheAdapter.php b/src/SimpleCacheAdapter.php index 4617332..b7bfd7f 100644 --- a/src/SimpleCacheAdapter.php +++ b/src/SimpleCacheAdapter.php @@ -3,7 +3,6 @@ namespace Vectorface\Cache; use Psr\SimpleCache\CacheInterface; -use Traversable; /** * Adapts a Vectorface cache instance to the PSR SimpleCache interface. @@ -12,8 +11,6 @@ class SimpleCacheAdapter implements CacheInterface { /** * Create an adapter over a Vectorface cache instance to the SimpleCache interface. - * - * @param Cache $cache */ public function __construct( protected Cache $cache, @@ -22,7 +19,7 @@ public function __construct( /** * @inheritDoc */ - public function get($key, $default = null) + public function get(string $key, mixed $default = null): mixed { return $this->cache->get($key, $default); } @@ -31,7 +28,7 @@ public function get($key, $default = null) * @inheritDoc * @throws Exception\CacheException */ - public function set($key, $value, $ttl = null) : bool + public function set(string $key, mixed $value, null|int|\DateInterval $ttl = null): bool { return $this->cache->set($key, $value, $ttl); } @@ -39,7 +36,7 @@ public function set($key, $value, $ttl = null) : bool /** * @inheritDoc */ - public function delete($key) : bool + public function delete(string $key): bool { return $this->cache->delete($key); } @@ -54,28 +51,25 @@ public function clear() : bool /** * @inheritDoc - * @param array|Traversable $keys */ - public function getMultiple($keys, $default = null) : iterable + public function getMultiple(iterable $keys, mixed $default = null): iterable { return $this->cache->getMultiple($keys, $default); } /** * @inheritDoc - * @param array|Traversable $values * @throws Exception\CacheException */ - public function setMultiple($values, $ttl = null) : bool + public function setMultiple(iterable $values, null|int|\DateInterval $ttl = null): bool { return $this->cache->setMultiple($values, $ttl); } /** * @inheritDoc - * @param array|Traversable $keys */ - public function deleteMultiple($keys) : bool + public function deleteMultiple(iterable $keys): bool { return $this->cache->deleteMultiple($keys); } @@ -83,7 +77,7 @@ public function deleteMultiple($keys) : bool /** * @inheritDoc */ - public function has($key) : bool + public function has(string $key): bool { return $this->cache->has($key); } From 2880c90c90f8502f6305e6bda7978951cae7f3b4 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Thu, 26 Jun 2025 16:59:36 -0400 Subject: [PATCH 2/4] More test version coverage --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8db2bb7..cfef4f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,8 +16,8 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest] - php-versions: ['8.0', '8.1', '8.2', '8.3'] - redis-versions: ['6.0'] + php-versions: ['8.0', '8.1', '8.2', '8.3', '8.4'] + redis-versions: ['6.0', '7.x', '8.x'] steps: - name: Checkout From 13ce8f2335b6ba84afc04030d7132a9ee1f3f316 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Thu, 26 Jun 2025 17:00:25 -0400 Subject: [PATCH 3/4] Fix CI to run on develop target --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cfef4f6..5d72429 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,9 +4,11 @@ on: push: branches: - master + - develop pull_request: branches: - master + - develop jobs: test: From 8a4924e6d486cb24cf72674ff20c57e259dec6ab Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Thu, 26 Jun 2025 17:01:29 -0400 Subject: [PATCH 4/4] Fix --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d72429..5e85987 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,14 +12,14 @@ on: jobs: test: - name: PHP ${{ matrix.php-versions }} on ${{ matrix.operating-system }} + name: PHP${{ matrix.php-versions }} | Redis${{ matrix.redis-versions }} on ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }} strategy: fail-fast: false matrix: operating-system: [ubuntu-latest] php-versions: ['8.0', '8.1', '8.2', '8.3', '8.4'] - redis-versions: ['6.0', '7.x', '8.x'] + redis-versions: ['6.2', '7.4', '8.0'] steps: - name: Checkout @@ -49,7 +49,7 @@ jobs: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - name: Cache composer dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}