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