Created
February 25, 2014 19:37
-
-
Save jsylvanus/9216125 to your computer and use it in GitHub Desktop.
pre-commit hook to not allow user to commit broken php files
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
#!/usr/bin/env bash | |
result=`find . -type f -iname '*.php' -exec php -l {} \; 2>&1 1> /dev/null` | |
if [ ! -z "$result" ]; then | |
echo "Found errors in your PHP files, refusing to commit." 1>&2 | |
echo $result 1>&2 | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment