diff --git a/.githooks/pre-commit b/.githooks/pre-commit index dfd754ed..84f88596 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -57,32 +57,15 @@ yarn markdownlint-cli2 '**/*.md' '#node_modules' '#vendor' '#tools' '#CHANGELOG. echo "" echo "Lint PHP Files..." -PHP_CS_FIXER="vendor/bin/php-cs-fixer" -HAS_PHP_CS_FIXER=false - -if [ -x $PHP_CS_FIXER ]; then - HAS_PHP_CS_FIXER=true -fi - -if $HAS_PHP_CS_FIXER; then - FILES=` git status --porcelain | grep -e '^[AM]\(.*\).php$' | cut -c 3- | tr '\n' ' '` - if [ -z "$FILES" ] - then - echo "No php files found in commit." - else - echo ${FILES} - $PHP_CS_FIXER fix --config .php-cs-fixer.dist.php --verbose ${FILES} --diff - git add ${FILES} - fi -else - echo "" - echo "Please install php-cs-fixer with" - echo "" - echo " composer install" - echo "or" - echo " composer require friendsofphp/php-cs-fixer" - echo "" - exit 1 +FILES=` git status --porcelain | grep -e '^[AM]\(.*\).php$' | cut -c 3- | sed 's/config\/bundles.php//' | xargs` +if [ -z "$FILES" ] + then + echo "No php files found in commit." + else + echo ${FILES} + vendor/bin/phpstan analyse --configuration=phpstan.dist.neon ${FILES} + vendor/bin/php-cs-fixer fix --config .php-cs-fixer.dist.php --verbose ${FILES} --diff + git add ${FILES} fi echo ""