From f143d141a6f6c793ad1045a9dc01782d593b8631 Mon Sep 17 00:00:00 2001 From: vedavith Date: Mon, 8 Jun 2026 07:30:35 +0530 Subject: [PATCH] Add PHPStan static analysis at level 5 Adds phpstan/phpstan as a dev dependency with a phpstan.neon config targeting src/ at level 5. Wires it into CI before the test step. Also removes a dead private property in ConfigLoader that PHPStan flagged. --- .github/workflows/php.yml | 3 +++ composer.json | 3 ++- phpstan.neon | 4 ++++ src/Config/ConfigLoader.php | 2 -- 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 phpstan.neon diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 8f66c71..b7d8dff 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -50,6 +50,9 @@ jobs: composer install --prefer-dist --no-progress --no-interaction if [ -n "$LOG_COVERAGE" ]; then mkdir -p coverage; fi + - name: Static analysis (PHPStan) + run: vendor/bin/phpstan analyse --no-progress + - name: Run tests run: | vendor/bin/phpunit \ diff --git a/composer.json b/composer.json index 4eb3c6a..88feeab 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,8 @@ }, "require-dev": { "phpunit/phpunit": "^13.0", - "mockery/mockery": "^1.6" + "mockery/mockery": "^1.6", + "phpstan/phpstan": "^2.2" }, "bin": [ diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..91e6453 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,4 @@ +parameters: + level: 5 + paths: + - src diff --git a/src/Config/ConfigLoader.php b/src/Config/ConfigLoader.php index b7d8b63..70f0bb1 100644 --- a/src/Config/ConfigLoader.php +++ b/src/Config/ConfigLoader.php @@ -6,8 +6,6 @@ class ConfigLoader { - private array $config = []; - /** * @throws Exception */