Last active
December 15, 2015 10:03
-
-
Save zhouyl/c284d7c244eea333ce42 to your computer and use it in GitHub Desktop.
Fix PHP Coding Style
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### Automatic fixed php coding style ### | |
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 | |
root_dir=$(cd "$(dirname "$0")"; cd ..; pwd) | |
# require checked php library directories | |
php_dirs=(app/functions app/config app/controllers app/library app/models app/plugins app/tasks) | |
for dir in ${php_dirs[@]}; do | |
$bin fix $root_dir/$dir --level=all --fixers=-psr0 | |
done | |
echo 'done.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment