Skip to content

Instantly share code, notes, and snippets.

@alongosz
Created June 27, 2018 07:48
Show Gist options
  • Save alongosz/32cb751ce9570e4fb525ddc47dd03d7e to your computer and use it in GitHub Desktop.
Save alongosz/32cb751ce9570e4fb525ddc47dd03d7e to your computer and use it in GitHub Desktop.
Applies php-cs-fixer to the code staged for commit
#!/bin/bash
#
# Copyright (c) 2017 - 2018, Andrew Longosz
#
files=$(git diff --cached --name-only --diff-filter=ACMRTU|grep '.php$'|paste -sd ' ' -)
echo "Fixing new and/or modified files: $files"
php-cs-fixer -v --config=.php_cs fix $files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment