Skip to content

Instantly share code, notes, and snippets.

@k4200
Created July 17, 2015 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k4200/c5b87d0f88459b6c9b44 to your computer and use it in GitHub Desktop.
Save k4200/c5b87d0f88459b6c9b44 to your computer and use it in GitHub Desktop.
pre-commit that executes php-cs-fixer for the committed files
#!/bin/bash
# Based on this gist https://gist.github.com/mardix/3623562
while read -r file;
do
if [[ $file = *.php ]];
then
php-cs-fixer fix "$file" --fixers=-phpdoc_params,-psr0,-visibility
git add "$file"
fi
done < <(git diff --cached --name-only --diff-filter=ACM)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment