Skip to content

Instantly share code, notes, and snippets.

@lillesvin
Created August 28, 2015 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lillesvin/2f94f433f8e35721ab2e to your computer and use it in GitHub Desktop.
Save lillesvin/2f94f433f8e35721ab2e to your computer and use it in GitHub Desktop.
Creates a git command 'lint-php' (if this script exists in your PATH and is executable) that syntax checks all modified/added files that end in ".php".
#!/bin/bash
files=$(git status --porcelain | sed -e 's/^.* //' | grep -P '\.php$')
for f in $files; do
php -l $f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment