Skip to content

Instantly share code, notes, and snippets.

@hayzem
Created October 10, 2017 12:38
Show Gist options
  • Save hayzem/c277b135b0f850a282eb9c9dc143c7f3 to your computer and use it in GitHub Desktop.
Save hayzem/c277b135b0f850a282eb9c9dc143c7f3 to your computer and use it in GitHub Desktop.
Bash script for PHP CS Fix with git pre-commit hook
#!/usr/bin/env bash
git status|grep -E "(.php)"| cut -d':' -f 2| while read -r line ; do
echo "php cs fix: $line"
/usr/local/bin/php /usr/local/bin/php-cs-fixer fix ${line} --rules=@Symfony
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment