Skip to content

Instantly share code, notes, and snippets.

@jsylvanus
Created February 25, 2014 19:37
Show Gist options
  • Save jsylvanus/9216125 to your computer and use it in GitHub Desktop.
Save jsylvanus/9216125 to your computer and use it in GitHub Desktop.
pre-commit hook to not allow user to commit broken php files
#!/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