-
-
Save kefzce/5371fe31035858df5722ada48402de44 to your computer and use it in GitHub Desktop.
php-cs-fixer pre-commit hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| echo "php-cs-fixer pre commit hook start" | |
| PHP_CS_FIXER="bin/php-cs-fixer" | |
| PHP_CS_CONFIG=".php_cs" | |
| CHANGED_FILES=$(git diff --cached --name-only --diff-filter=ACM -- '*.php') | |
| if [ -n "$CHANGED_FILES" ]; then | |
| $PHP_CS_FIXER fix --config "$PHP_CS_CONFIG" $CHANGED_FILES; | |
| git add $CHANGED_FILES; | |
| fi | |
| echo "php-cs-fixer pre commit hook finish" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment