Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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"
@chrisnx

This comment has been minimized.

Copy link

chrisnx commented Jul 22, 2015

You'll need to have done this:
composer require fabpot/php-cs-fixer

@rossey

This comment has been minimized.

Copy link

rossey commented Jul 22, 2015

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 can’t perform that action at this time.