Skip to content

Instantly share code, notes, and snippets.

@friek
Created September 8, 2016 15:03
Show Gist options
  • Save friek/f78e154060b2a141b9320a57c92ff31e to your computer and use it in GitHub Desktop.
Save friek/f78e154060b2a141b9320a57c92ff31e to your computer and use it in GitHub Desktop.
Run a php lint check on all php files which are to be committed
#!/bin/bash
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
exit 0
fi
set -e
IFS="\n" \
git diff --name-only HEAD | \
while read fn; do
if [[ "$fn" == *".php" ]]; then
if [ -f "$fn" ]; then
php -l "$fn"
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment