Created
July 17, 2015 14:32
-
-
Save k4200/c5b87d0f88459b6c9b44 to your computer and use it in GitHub Desktop.
pre-commit that executes php-cs-fixer for the committed files
This file contains 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
#!/bin/bash | |
# Based on this gist https://gist.github.com/mardix/3623562 | |
while read -r file; | |
do | |
if [[ $file = *.php ]]; | |
then | |
php-cs-fixer fix "$file" --fixers=-phpdoc_params,-psr0,-visibility | |
git add "$file" | |
fi | |
done < <(git diff --cached --name-only --diff-filter=ACM) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment