diff --git a/.gitattributes b/.gitattributes
index d2354a6..2955355 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -30,7 +30,7 @@
/.styleci.yml export-ignore
/infection.json.dist export-ignore
/phpunit.xml.dist export-ignore
-/psalm.xml export-ignore
+/phpstan.neon export-ignore
/tests export-ignore
/docs export-ignore
diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml
index cd61262..c74a219 100644
--- a/.github/workflows/mutation.yml
+++ b/.github/workflows/mutation.yml
@@ -8,7 +8,7 @@ on:
- '.github/workflows/mutation.yml'
- 'composer.json'
- 'infection.json.dist'
- - 'psalm.xml'
+ - 'phpstan.neon'
push:
branches: ['master']
paths: *paths
diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml
index 475179e..9162c8e 100644
--- a/.github/workflows/static.yml
+++ b/.github/workflows/static.yml
@@ -5,7 +5,7 @@ on:
paths: &paths
- '.github/workflows/static.yml'
- 'src/**'
- - 'psalm*.xml'
+ - 'phpstan.neon'
- 'composer.json'
push:
branches: ['master']
@@ -15,11 +15,11 @@ permissions:
contents: read
jobs:
- psalm:
- uses: yiisoft/actions/.github/workflows/psalm.yml@master
+ phpstan:
+ uses: yiisoft/actions/.github/workflows/phpstan.yml@master
with:
extensions: pdo, pdo_pgsql
os: >-
['ubuntu-latest']
php: >-
- ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
+ ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5', '8.6']
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9da5ef5..15db6e1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,7 @@
## 1.2.1 under development
-- no changes in this release.
+- Chg #60: Replace Psalm with PHPStan (@vjik)
## 1.2.0 November 13, 2026
diff --git a/README.md b/README.md
index 5b97cd3..6801be4 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,6 @@
[](https://codecov.io/gh/yiisoft/mutex-pdo-pgsql)
[](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/mutex-pdo-pgsql/master)
[](https://github.com/yiisoft/mutex-pdo-pgsql/actions?query=workflow%3A%22static+analysis%22)
-[](https://shepherd.dev/github/yiisoft/mutex-pdo-pgsql)
This library provides a PostgreSQL mutex implementation for [yiisoft/mutex](https://github.com/yiisoft/mutex).
diff --git a/composer.json b/composer.json
index 0f4a02a..66cf28a 100644
--- a/composer.json
+++ b/composer.json
@@ -34,11 +34,11 @@
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.95",
"infection/infection": "^0.26.6 || ^0.27.10 || ^0.29.8 || ^0.35.8",
+ "phpstan/phpstan": "^2.3",
"phpunit/phpunit": "^9.6.35",
"rector/rector": "^2.8.3",
"shipmonk/composer-dependency-analyser": "^1.8",
"spatie/phpunit-watcher": "^1.23",
- "vimeo/psalm": "^4.30 || ^5.26.1 || ^6.16.1",
"yiisoft/code-style": "^1.1"
},
"autoload": {
@@ -61,7 +61,7 @@
"scripts": {
"cs-fix": "php-cs-fixer fix",
"dependency-analyser": "composer-dependency-analyser",
- "psalm": "psalm",
+ "phpstan": "phpstan",
"rector": "rector",
"test": "phpunit --testdox --no-interaction",
"test-watch": "phpunit-watcher watch"
diff --git a/docs/internals.md b/docs/internals.md
index e34dbba..1fce91a 100644
--- a/docs/internals.md
+++ b/docs/internals.md
@@ -18,10 +18,10 @@ The package tests are checked with [Infection](https://infection.github.io/) mut
## Static analysis
-The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis:
+The code is statically analyzed with [PHPStan](https://phpstan.org/). To run static analysis:
```shell
-./vendor/bin/psalm
+./vendor/bin/phpstan
```
## Dependencies
diff --git a/phpstan.neon b/phpstan.neon
new file mode 100644
index 0000000..776ccd8
--- /dev/null
+++ b/phpstan.neon
@@ -0,0 +1,4 @@
+parameters:
+ level: max
+ paths:
+ - src
diff --git a/psalm.xml b/psalm.xml
deleted file mode 100644
index fa5f129..0000000
--- a/psalm.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/src/PgsqlMutex.php b/src/PgsqlMutex.php
index 910f84e..32910e3 100644
--- a/src/PgsqlMutex.php
+++ b/src/PgsqlMutex.php
@@ -18,6 +18,7 @@
*/
final class PgsqlMutex extends Mutex
{
+ /** @var list */
private array $lockKeys;
private PDO $connection;
@@ -31,12 +32,12 @@ public function __construct(string $name, PDO $connection)
* Decode the first eight hash bytes in big-endian order and normalize to PostgreSQL signed int4 keys.
* On 32-bit PHP, unpack() already returns signed integers for words with the high bit set.
*
- * @psalm-suppress PossiblyFalseArgument `unpack()` never returns `false` here because `sha1(...)` with raw
- * output always returns a 20-byte string, enough for the eight bytes required by the 'N2' format.
+ * `unpack()` never returns `false` here because `sha1(...)` with raw output always returns a 20-byte string,
+ * enough for the eight bytes required by the 'N2' format.
*/
$this->lockKeys = array_values(array_map(
- static fn(int $key): int => $key > 0x7FFFFFFF ? $key - 0x100000000 : $key,
- unpack('N2', sha1($name, true)),
+ static fn(int $key): int => $key > 0x7FFFFFFF ? $key - 0x100000000 : $key, // @phpstan-ignore argument.type
+ unpack('N2', sha1($name, true)), // @phpstan-ignore argument.type
));
$this->connection = $connection;