Skip to content

Instantly share code, notes, and snippets.

@adirkuhn
adirkuhn / php-lint-pre-commit.sh
Created April 18, 2018 11:22 — forked from filipekiss/php-lint-pre-commit.sh
A *really* simple git pre-commit-hook that lints all staged PHP files.
#!/bin/bash
stagedFiles=$(git diff-index --cached HEAD | grep ".php" | grep "^:" | cut -f2);
phpLintErrors=0
echo "PHP will now lint all the php staged files..."
echo ""
for file in $stagedFiles
do
echo "PHP is linting $file...";
echo ""
php -l $file