Last active
July 26, 2016 09:14
-
-
Save mehdichaouch/bb0696c93a9b67fbc3b8 to your computer and use it in GitHub Desktop.
Script Git hook which run php-cs-fixer on files to commit
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
#!/bin/bash | |
# https://gist.github.com/mardix/3623562 | |
while read -r file; | |
do | |
if [[ $file = *.php ]]; | |
then | |
php-cs-fixer fix "$file" --level=psr2 | |
git add "$file" | |
fi | |
done < <(git diff-index --cached --name-only --diff-filter=ACM HEAD) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment