Created
May 1, 2019 11:22
-
-
Save spelcaster/6c6ce2757bfefa7eb337c040e901649f to your computer and use it in GitHub Desktop.
Git Hooks for PHP projects
This file contains 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/bash | |
retval=0 | |
while read -r filepath; do | |
vendor/bin/phplint "$filepath" | |
retval=$(( $retval + $? )) | |
done < <(git diff --cached --name-status | awk '$1 != "D" { print $2 }' | grep ".php") | |
if [[ $retval -gt 0 ]]; then | |
echo "PHP Syntax error found" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You must install overtrue/phplint in your project to use this hook