From e2c394410757c6f13d1c6ba7da646600eecabf2d Mon Sep 17 00:00:00 2001 From: "steven.lewis" Date: Thu, 10 Oct 2024 11:42:48 +0100 Subject: [PATCH 1/8] Compatability with php 8.4 Deprecate implicitly nullable parameter types https://wiki.php.net/rfc/deprecate-implicitly-nullable-types --- lib/Phpfastcache/Cluster/AggregatorInterface.php | 2 +- lib/Phpfastcache/Cluster/ClusterAggregator.php | 2 +- lib/Phpfastcache/Drivers/Redis/Config.php | 2 +- lib/Phpfastcache/Exceptions/PhpfastcacheIOException.php | 2 +- lib/Phpfastcache/Helper/Psr16Adapter.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Phpfastcache/Cluster/AggregatorInterface.php b/lib/Phpfastcache/Cluster/AggregatorInterface.php index c14a3c72..5364ee6d 100644 --- a/lib/Phpfastcache/Cluster/AggregatorInterface.php +++ b/lib/Phpfastcache/Cluster/AggregatorInterface.php @@ -86,7 +86,7 @@ public function getCluster(int $strategy): ClusterPoolInterface; * * @return void */ - public function aggregateDriverByName(string $driverName, ConfigurationOption $driverConfig = null): void; + public function aggregateDriverByName(string $driverName, ?ConfigurationOption $driverConfig = null): void; /** * @param AggregatablePoolInterface $driverPool diff --git a/lib/Phpfastcache/Cluster/ClusterAggregator.php b/lib/Phpfastcache/Cluster/ClusterAggregator.php index 6f080e01..69df214f 100644 --- a/lib/Phpfastcache/Cluster/ClusterAggregator.php +++ b/lib/Phpfastcache/Cluster/ClusterAggregator.php @@ -94,7 +94,7 @@ public function aggregateDriver(AggregatablePoolInterface $driverPool): void * @throws PhpfastcacheDriverNotFoundException * @throws PhpfastcacheLogicException */ - public function aggregateDriverByName(string $driverName, ConfigurationOption $driverConfig = null): void + public function aggregateDriverByName(string $driverName, ?ConfigurationOption $driverConfig = null): void { if (isset($this->cluster)) { throw new PhpfastcacheLogicException('The cluster has been already build, cannot aggregate more pools.'); diff --git a/lib/Phpfastcache/Drivers/Redis/Config.php b/lib/Phpfastcache/Drivers/Redis/Config.php index 1d43e784..f87536d3 100644 --- a/lib/Phpfastcache/Drivers/Redis/Config.php +++ b/lib/Phpfastcache/Drivers/Redis/Config.php @@ -98,7 +98,7 @@ public function getDatabase(): ?int * @return static * @throws PhpfastcacheLogicException */ - public function setDatabase(int $database = null): static + public function setDatabase(?int $database = null): static { return $this->setProperty('database', $database); } diff --git a/lib/Phpfastcache/Exceptions/PhpfastcacheIOException.php b/lib/Phpfastcache/Exceptions/PhpfastcacheIOException.php index 38ed42df..52284009 100644 --- a/lib/Phpfastcache/Exceptions/PhpfastcacheIOException.php +++ b/lib/Phpfastcache/Exceptions/PhpfastcacheIOException.php @@ -24,7 +24,7 @@ class PhpfastcacheIOException extends PhpfastcacheCoreException /** * @inheritdoc */ - public function __construct(string $message = "", int $code = 0, \Throwable $previous = null) + public function __construct(string $message = "", int $code = 0, ?\Throwable $previous = null) { $lastError = error_get_last(); if ($lastError) { diff --git a/lib/Phpfastcache/Helper/Psr16Adapter.php b/lib/Phpfastcache/Helper/Psr16Adapter.php index f201ea30..fbed034f 100644 --- a/lib/Phpfastcache/Helper/Psr16Adapter.php +++ b/lib/Phpfastcache/Helper/Psr16Adapter.php @@ -49,7 +49,7 @@ class Psr16Adapter implements CacheInterface * @throws PhpfastcacheDriverException * @throws PhpfastcacheDriverNotFoundException */ - public function __construct(string|ExtendedCacheItemPoolInterface $driver, ConfigurationOptionInterface $config = null) + public function __construct(string|ExtendedCacheItemPoolInterface $driver, ?ConfigurationOptionInterface $config = null) { if ($driver instanceof ExtendedCacheItemPoolInterface) { if ($config !== null) { From 47a116789090f0fb32644c4a20e168cc21dc4c62 Mon Sep 17 00:00:00 2001 From: "steven.lewis" Date: Thu, 10 Oct 2024 17:19:51 +0100 Subject: [PATCH 2/8] Compatability with php 8.4 Deprecate implicitly nullable parameter types https://wiki.php.net/rfc/deprecate-implicitly-nullable-types --- lib/Phpfastcache/CacheContract.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Phpfastcache/CacheContract.php b/lib/Phpfastcache/CacheContract.php index 1a5f0362..0d0d80c3 100644 --- a/lib/Phpfastcache/CacheContract.php +++ b/lib/Phpfastcache/CacheContract.php @@ -32,7 +32,7 @@ public function __construct(CacheItemPoolInterface $cacheInstance) /** * @throws InvalidArgumentException */ - public function get(string|\Stringable $cacheKey, callable $callback, DateInterval|int $expiresAfter = null): mixed + public function get(string|\Stringable $cacheKey, callable $callback, DateInterval|int|null $expiresAfter = null): mixed { $cacheItem = $this->cacheInstance->getItem((string) $cacheKey); @@ -54,7 +54,7 @@ public function get(string|\Stringable $cacheKey, callable $callback, DateInterv /** * @throws InvalidArgumentException */ - public function __invoke(string $cacheKey, callable $callback, DateInterval|int $expiresAfter = null): mixed + public function __invoke(string $cacheKey, callable $callback, DateInterval|int|null $expiresAfter = null): mixed { return $this->get($cacheKey, $callback, $expiresAfter); } From a234611ecc5bdf653cd4f2a94962bd09cc26f4da Mon Sep 17 00:00:00 2001 From: Steven Lewis Date: Thu, 24 Oct 2024 10:36:13 +0100 Subject: [PATCH 3/8] Delete .travis.yml, using git actions --- .travis.yml | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 60551c76..00000000 --- a/.travis.yml +++ /dev/null @@ -1,49 +0,0 @@ -# -# This file is part of phpFastCache. -# -# @license MIT License (MIT) -# -# For full copyright and license information, please see the docs/CREDITS.txt file. -# -# @author Georges.L (Geolim4) -# @author Contributors https://github.com/PHPSocialNetwork/phpfastcache/graphs/contributors -# -os: linux -dist: bionic -language: php - -services: - - memcached - - redis -cache: - directories: - - $HOME/pecl_cache -php: - - 8.0 - - 8.1 - - 8.2 -jobs: - fast_finish: true - allow_failures: - - php: nightly - -before_install: - - sudo apt remove cmake - - pip install cmake --upgrade - - phpenv config-add bin/ci/php_common.ini - - phpenv config-rm xdebug.ini - - composer install - - composer require phwoolcon/ci-pecl-cacher -n - - "./bin/ci/scripts/install_ssdb.sh || echo \"SSDB install failed\"" - - "./bin/ci/scripts/install_couchbase.sh || echo \"Couchbase install failed\"" - - "./bin/ci/scripts/setup_gcp.sh || echo \"GCP setup failed\"" - - "pecl channel-update pecl.php.net || echo \"PECL Channel update failed\"" - - "yes | ./vendor/bin/ci-pecl-install memcache || echo \"PECL Memcache install failed\"" - - "yes | ./vendor/bin/ci-pecl-install memcached || echo \"PECL Memcached install failed\"" - - "yes | ./vendor/bin/ci-pecl-install couchbase-3.2.2 couchbase || echo \"PECL Couchbase install failed\"" # @todo UPGRADE TO COUCHBASE 4.x.x once we upgraded from Bionic to Focal -install: - - ./bin/ci/scripts/install_dependencies.sh - -script: - - composer run-script quality - - composer run-script tests From 61d2acf3ddc7f8704c333b6c0a2db046b74022fa Mon Sep 17 00:00:00 2001 From: "steven.lewis" Date: Tue, 12 Nov 2024 09:36:41 +0000 Subject: [PATCH 4/8] CI failure testing --- tests/cases/GetAllItems.test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cases/GetAllItems.test.php b/tests/cases/GetAllItems.test.php index 239714ee..ae3dc5fc 100644 --- a/tests/cases/GetAllItems.test.php +++ b/tests/cases/GetAllItems.test.php @@ -44,7 +44,7 @@ $drivers = [ 'Memory', 'Predis', - 'Redis', + //'Redis', 'RedisCluster', ]; From 2bd3f6909b50c832f45133ab2d105cd593b59b28 Mon Sep 17 00:00:00 2001 From: "steven.lewis" Date: Tue, 12 Nov 2024 10:40:32 +0000 Subject: [PATCH 5/8] CI failure testing --- .github/workflows/testsv2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testsv2.yml b/.github/workflows/testsv2.yml index 98679d44..72deb5f7 100644 --- a/.github/workflows/testsv2.yml +++ b/.github/workflows/testsv2.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: operating-system: [ubuntu-latest] - php-versions: ['8.0', '8.1', '8.2', '8.3'] + php-versions: ['8.0', '8.1', '8.2', '8.3', '8.4'] name: PHP ${{ matrix.php-versions }} quality/tests on ${{ matrix.operating-system }} env: extensions: mbstring, intl, pdo_sqlite, json, redis, couchbase-3.2.2 From 759b1613e4a0c33ee7788d064da61a2ede1a7a67 Mon Sep 17 00:00:00 2001 From: "steven.lewis" Date: Thu, 28 Nov 2024 10:55:31 +0000 Subject: [PATCH 6/8] WIP fix testing --- .github/workflows/testsv2.yml | 2 +- tests/cases/GetAllItems.test.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testsv2.yml b/.github/workflows/testsv2.yml index 72deb5f7..83b9de9b 100644 --- a/.github/workflows/testsv2.yml +++ b/.github/workflows/testsv2.yml @@ -49,7 +49,7 @@ jobs: - name: Setup Redis server uses: zhulik/redis-action@v1.0.0 with: - redis version: '5' + redis version: '6' - name: Validate composer.json and composer.lock run: composer validate --strict diff --git a/tests/cases/GetAllItems.test.php b/tests/cases/GetAllItems.test.php index ae3dc5fc..239714ee 100644 --- a/tests/cases/GetAllItems.test.php +++ b/tests/cases/GetAllItems.test.php @@ -44,7 +44,7 @@ $drivers = [ 'Memory', 'Predis', - //'Redis', + 'Redis', 'RedisCluster', ]; From 43f70b76c7b321dc4804f93c03fadb1a0f0cb864 Mon Sep 17 00:00:00 2001 From: "steven.lewis" Date: Thu, 28 Nov 2024 10:59:41 +0000 Subject: [PATCH 7/8] WIP fix testing --- .github/workflows/testsv2.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/testsv2.yml b/.github/workflows/testsv2.yml index 83b9de9b..15c4a3a2 100644 --- a/.github/workflows/testsv2.yml +++ b/.github/workflows/testsv2.yml @@ -5,6 +5,7 @@ jobs: environment: github-ci runs-on: ${{ matrix.operating-system }} timeout-minutes: 60 + continue-on-error: true strategy: matrix: operating-system: [ubuntu-latest] From 1434676fc283eec13ae61dc5038cad79d28ed348 Mon Sep 17 00:00:00 2001 From: "steven.lewis" Date: Thu, 28 Nov 2024 11:25:58 +0000 Subject: [PATCH 8/8] WIP fix testing --- .github/workflows/testsv2.yml | 2 +- tests/cases/GetAllItems.test.php | 1 + tests/cases/Redis.test.php | 1 + tests/cases/RedisCluster.test.php | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testsv2.yml b/.github/workflows/testsv2.yml index 15c4a3a2..9c0ba79a 100644 --- a/.github/workflows/testsv2.yml +++ b/.github/workflows/testsv2.yml @@ -50,7 +50,7 @@ jobs: - name: Setup Redis server uses: zhulik/redis-action@v1.0.0 with: - redis version: '6' + redis version: '5' - name: Validate composer.json and composer.lock run: composer validate --strict diff --git a/tests/cases/GetAllItems.test.php b/tests/cases/GetAllItems.test.php index 239714ee..b91b9ba4 100644 --- a/tests/cases/GetAllItems.test.php +++ b/tests/cases/GetAllItems.test.php @@ -28,6 +28,7 @@ require_once __DIR__ . '/../../vendor/autoload.php'; $testHelper = new TestHelper('Testing getAllItems() method'); +$testHelper->printText('[EXTENTION: (redis) v' . \phpversion('redis') . ']'); /** * https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV5%CB%96%5D-Fetching-all-keys diff --git a/tests/cases/Redis.test.php b/tests/cases/Redis.test.php index 4c8573df..f020fefd 100644 --- a/tests/cases/Redis.test.php +++ b/tests/cases/Redis.test.php @@ -21,6 +21,7 @@ chdir(__DIR__); require_once __DIR__ . '/../../vendor/autoload.php'; $testHelper = new TestHelper('Redis bundled client'); +$testHelper->printText('[EXTENTION: (redis) v' . \phpversion('redis') . ']'); try { if (!class_exists(RedisClient::class)) { diff --git a/tests/cases/RedisCluster.test.php b/tests/cases/RedisCluster.test.php index af75f362..c63ff872 100644 --- a/tests/cases/RedisCluster.test.php +++ b/tests/cases/RedisCluster.test.php @@ -19,6 +19,7 @@ chdir(__DIR__); require_once __DIR__ . '/../../vendor/autoload.php'; $testHelper = new TestHelper('Redis cluster'); +$testHelper->printText('[EXTENTION: (redis) v' . \phpversion('redis') . ']'); try { $config = new RedisConfig();