Skip to content

Instantly share code, notes, and snippets.

@thoroc
Forked from zhouyl/fix-php-coding-style.sh
Last active May 3, 2017 13:55
Show Gist options
  • Save thoroc/170b08fcc653b6086fed to your computer and use it in GitHub Desktop.
Save thoroc/170b08fcc653b6086fed to your computer and use it in GitHub Desktop.
Fix PHP Coding Style for Symfony2 project
#!/bin/bash
# we are assuming php-cs-fixer installation path
BIN=/usr/local/bin/php-cs-fixer
# install php-cs-fixer
if [ ! -f $bin ]; then
echo "Preparing to install php-cs-fixer ..."
wget http://cs.sensiolabs.org/get/php-cs-fixer.phar -O $bin
chmod a+x $bin
echo "php-cs-fixer has been successfully installed."
fi
# using git to get the path to the project
BASE_PATH=$(git rev-parse --show-toplevel)
if [ $? != 0 ]; then
echo "run this at the root of the project"
exit 1;
fi
php-cs-fixer fix $BASE_PATH/src --fixers=@symfony,align_double_arrow,align_equals,ordered_use,short_array_syntax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment