Last active
December 14, 2015 08:39
-
-
Save rkaldung/5059554 to your computer and use it in GitHub Desktop.
git pre-commit hook with php lint and code style fix
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/sh | |
# | |
# adjust php-cs-fixer configuration if needed, see http://cs.sensiolabs.org/ | |
# Redirect output to stderr. | |
exec 1>&2 | |
for f in $(git diff --cached --name-only --diff-filter=AMC | grep -e '\.php$') | |
do | |
php -l "${f}" || exit 1 | |
php-cs-fixer fix "${f}" --fixers=php_closing_tag | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment