Created
July 22, 2015 09:59
-
-
Save dave1010/6059d3626cd529e11420 to your computer and use it in GitHub Desktop.
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 | |
# stolen from template file | |
if git rev-parse --verify HEAD > /dev/null | |
then | |
against=HEAD | |
else | |
# Initial commit: diff against an empty tree object | |
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 | |
fi | |
# this is the magic: | |
# retrieve all files in staging area that are added, modified or renamed | |
# but no deletions etc | |
FILES=$(git diff-index --name-only --cached --diff-filter=ACMR $against -- | grep php$) | |
if [ "$FILES" == "" ]; then | |
exit 0 | |
fi | |
echo -n "PHP CS Fixer " | |
for FILE in $FILES | |
do | |
php vendor/fabpot/php-cs-fixer/php-cs-fixer fix $FILE --config=sf23 --quiet | |
echo -n . | |
done | |
echo " Done" |
And it's currently set to Symfony Framework v2.3 standards/glitter
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You'll need to have done this:
composer require fabpot/php-cs-fixer