Skip to content

Instantly share code, notes, and snippets.

@liuxd
Last active September 7, 2017 01:19
Show Gist options
  • Save liuxd/5dd0c408c641a13956e7a8d4c2cf6e3f to your computer and use it in GitHub Desktop.
Save liuxd/5dd0c408c641a13956e7a8d4c2cf6e3f to your computer and use it in GitHub Desktop.
[php_sytax_checker] #GitHook
#!/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