From cbd502488bad86bd1a1188edb06ff51a319dcb4d Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Thu, 25 Jul 2024 23:29:52 +0800 Subject: [PATCH] chore: add composer scripts for phpstan --- .github/workflows/test-phpstan.yml | 2 +- composer.json | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-phpstan.yml b/.github/workflows/test-phpstan.yml index 360b403ac923..aca331f30481 100644 --- a/.github/workflows/test-phpstan.yml +++ b/.github/workflows/test-phpstan.yml @@ -85,4 +85,4 @@ jobs: run: composer update --ansi --no-interaction - name: Run static analysis - run: vendor/bin/phpstan analyse + run: composer phpstan:check diff --git a/composer.json b/composer.json index 71983002c180..c129969a49f9 100644 --- a/composer.json +++ b/composer.json @@ -92,7 +92,7 @@ ], "analyze": [ "Composer\\Config::disableProcessTimeout", - "bash -c \"XDEBUG_MODE=off vendor/bin/phpstan analyse\"", + "@phpstan:check", "vendor/bin/rector process --dry-run" ], "cs": [ @@ -110,6 +110,8 @@ "utils/vendor/bin/php-cs-fixer fix --ansi --verbose --diff" ], "metrics": "utils/vendor/bin/phpmetrics --config=phpmetrics.json", + "phpstan:baseline": "vendor/bin/phpstan analyse --ansi --generate-baseline=phpstan-baseline.php", + "phpstan:check": "vendor/bin/phpstan analyse --verbose --ansi", "sa": "@analyze", "style": "@cs-fix", "test": "phpunit" @@ -119,6 +121,8 @@ "cs": "Check the coding style", "cs-fix": "Fix the coding style", "metrics": "Run PhpMetrics", + "phpstan:baseline": "Run PHPStan then dump all errors to baseline", + "phpstan:check": "Run PHPStan with support for identifiers", "test": "Run unit tests" } }