From d87184d929ea11a663fd788329960486af00602b Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Fri, 16 Feb 2024 18:19:12 +0300 Subject: [PATCH 1/2] fix mutations --- .github/workflows/mutation.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index 4335d1d..bfa093f 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -39,8 +39,7 @@ jobs: - ubuntu-latest php: - - 8.1 - - 8.2 + - 8.3 services: postgres: @@ -74,6 +73,6 @@ jobs: - name: Run infection. run: | - vendor/bin/roave-infection-static-analysis-plugin -j2 --ignore-msi-with-no-mutations --only-covered --test-framework-options="--testsuite=Pgsql" + vendor/bin/roave-infection-static-analysis-plugin --threads=2 --ignore-msi-with-no-mutations --only-covered --test-framework-options="--testsuite=Pgsql" env: STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} From 90d4513a4a232b13fe4a607fa84e8c2c52260a9a Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Fri, 16 Feb 2024 18:25:18 +0300 Subject: [PATCH 2/2] Fix psalm --- .github/workflows/static.yml | 3 ++- composer.json | 2 +- psalm.xml | 29 ++++++++++++++++------------- src/DbCache.php | 5 +++-- 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index b5877cf..76e69f8 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -27,7 +27,7 @@ concurrency: cancel-in-progress: true jobs: - mutation: + psalm: name: PHP ${{ matrix.php }}-${{ matrix.os }} runs-on: ${{ matrix.os }} @@ -40,6 +40,7 @@ jobs: php: - '8.1' - '8.2' + - '8.3' steps: - name: Checkout. diff --git a/composer.json b/composer.json index 8dfb127..6cfa2ed 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "rector/rector": "^1.0.1", "roave/infection-static-analysis-plugin": "^1.25|^1.30", "spatie/phpunit-watcher": "^1.23", - "vimeo/psalm": "^4.8|^5.8", + "vimeo/psalm": "^4.30|^5.22", "yiisoft/cache": "^3.0", "yiisoft/log": "^2.0" }, diff --git a/psalm.xml b/psalm.xml index 23bfcce..b48c894 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,17 +1,20 @@ - - - - - - + + + + + + + + + + diff --git a/src/DbCache.php b/src/DbCache.php index f1340b4..0170b17 100644 --- a/src/DbCache.php +++ b/src/DbCache.php @@ -95,6 +95,9 @@ public function set(string $key, mixed $value, DateInterval|int|string|null $ttl } try { + /** + * @psalm-suppress MixedArgumentTypeCoercion `$this->buildDataRow()` next returns `array` + */ $this->db ->createCommand() ->upsert($this->table, $this->buildDataRow($key, $ttl, $value, true)) @@ -158,7 +161,6 @@ public function setMultiple(iterable $values, DateInterval|int|string|null $ttl $values = $this->iterableToArray($values); $rows = $keys = []; - /** @psalm-var mixed $value */ foreach ($values as $key => $value) { $key = (string) $key; $this->validateKey($key); @@ -366,7 +368,6 @@ private function validateKey(mixed $key): void */ private function validateKeys(array $keys): void { - /** @psalm-var mixed $key */ foreach ($keys as $key) { $this->validateKey($key); }