Skip to content

Instantly share code, notes, and snippets.

@mehdichaouch
Last active July 26, 2016 09:14
Show Gist options
  • Save mehdichaouch/bb0696c93a9b67fbc3b8 to your computer and use it in GitHub Desktop.
Save mehdichaouch/bb0696c93a9b67fbc3b8 to your computer and use it in GitHub Desktop.
Script Git hook which run php-cs-fixer on files to commit
#!/bin/bash
# https://gist.github.com/mardix/3623562
while read -r file;
do
if [[ $file = *.php ]];
then
php-cs-fixer fix "$file" --level=psr2
git add "$file"
fi
done < <(git diff-index --cached --name-only --diff-filter=ACM HEAD)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment