From f029f0d85fe8d45dc77ef7591571e7d1952b72e7 Mon Sep 17 00:00:00 2001 From: Gintautas Miselis Date: Fri, 27 May 2022 08:08:51 +0300 Subject: [PATCH 1/2] Support Codeception 5 --- .github/workflows/main.yml | 2 +- composer.json | 4 ++-- src/Codeception/Module/Memcache.php | 10 ++-------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ab7eb8b..e16675b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - php: [7.4, 8.0, 8.1] + php: [8.0, 8.1] steps: - name: Checkout code diff --git a/composer.json b/composer.json index 1ce465e..929683b 100644 --- a/composer.json +++ b/composer.json @@ -12,8 +12,8 @@ ], "minimum-stability": "RC", "require": { - "php": "^7.4 | ^8.0", - "codeception/codeception": "^4.0" + "php": "^8.0", + "codeception/codeception": "^5.0" }, "require-dev": { "ext-memcache": "*", diff --git a/src/Codeception/Module/Memcache.php b/src/Codeception/Module/Memcache.php index 52b804f..208e7c2 100644 --- a/src/Codeception/Module/Memcache.php +++ b/src/Codeception/Module/Memcache.php @@ -42,15 +42,9 @@ */ class Memcache extends Module { - /** - * @var \Memcache|Memcached|null - */ - public $memcache = null; + public \Memcache|Memcached|null $memcache = null; - /** - * @var array - */ - protected $config = [ + protected array $config = [ 'host' => 'localhost', 'port' => 11211 ]; From 3f880ccec2fbf7de0928a5844b0bcfbdc7d3b855 Mon Sep 17 00:00:00 2001 From: Gintautas Miselis Date: Fri, 27 May 2022 08:19:14 +0300 Subject: [PATCH 2/2] Use mixed type in method signatures --- src/Codeception/Module/Memcache.php | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/Codeception/Module/Memcache.php b/src/Codeception/Module/Memcache.php index 208e7c2..e2d7fd6 100644 --- a/src/Codeception/Module/Memcache.php +++ b/src/Codeception/Module/Memcache.php @@ -44,6 +44,9 @@ class Memcache extends Module { public \Memcache|Memcached|null $memcache = null; + /** + * @var array + */ protected array $config = [ 'host' => 'localhost', 'port' => 11211 @@ -93,10 +96,8 @@ public function _after(TestInterface $test): void * grabValueFromMemcached('users_count'); * ``` - * - * @return mixed */ - public function grabValueFromMemcached(string $key) + public function grabValueFromMemcached(string $key): mixed { $value = $this->memcache->get($key); $this->debugSection("Value", $value); @@ -117,10 +118,8 @@ public function grabValueFromMemcached(string $key) * // Checks a 'users_count' exists and has the value 200 * $I->seeInMemcached('users_count', 200); * ``` - * - * @param mixed $value */ - public function seeInMemcached(string $key, $value = null): void + public function seeInMemcached(string $key, mixed $value = null): void { $actual = $this->memcache->get($key); $this->debugSection("Value", $actual); @@ -145,10 +144,8 @@ public function seeInMemcached(string $key, $value = null): void * // Checks a 'users_count' exists does not exist or its value is not the one provided * $I->dontSeeInMemcached('users_count', 200); * ``` - * - * @param mixed $value */ - public function dontSeeInMemcached(string $key, $value = null): void + public function dontSeeInMemcached(string $key, mixed $value = null): void { $actual = $this->memcache->get($key); $this->debugSection("Value", $actual); @@ -162,10 +159,8 @@ public function dontSeeInMemcached(string $key, $value = null): void /** * Stores an item `$value` with `$key` on the Memcached server. - * - * @param mixed $value */ - public function haveInMemcached(string $key, $value, int $expiration = 0): void + public function haveInMemcached(string $key, mixed $value, int $expiration = 0): void { if (get_class($this->memcache) == 'Memcache') { $this->assertTrue($this->memcache->set($key, $value, 0, $expiration));