Last active
September 7, 2017 01:19
-
-
Save liuxd/5dd0c408c641a13956e7a8d4c2cf6e3f to your computer and use it in GitHub Desktop.
[php_sytax_checker] #GitHook
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 | |
# | |
# Check whether there is a syntax error in the php files. | |
for file in `git diff --cached --name-only`;do | |
if [ "${file##*.}" = "php" ];then | |
output=`php -l $file` | |
if [ $? -gt 0 ];then | |
echo $output | |
exit 1 | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment