files/default/git/hooks/php/phpcs
#!/bin/bash -e
PROJECT=`php -r "echo dirname(dirname(dirname(dirname(realpath('$0')))));"`
FILES=""
for FILE in `git diff --cached --name-only --diff-filter=ACMR HEAD | egrep \\\\.\(php\)\$`
do
FILES="$FILES $PROJECT/$FILE"
done
if [ "$FILES" != "" ]
then
echo "Running phpcs..."
phpcs --extensions=php --encoding=utf-8 $FILES || exit $?
fi
exit 0