版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/q601115211/article/details/78788449
安装
使用最简单的方式安装下载php-cs-fixer包,直接配置在编辑器。
最新php-cs-fixer包
windows 创建php-cs-fixer.bat
php php-cs-fixer.phar fix --config=.php_cs.dist %~sf1
pause
mas\linux 创建 php-cs-fixer
#!/bin/sh
/usr/local/php7/bin/php -d allow_url_fopen=On -d detect_unicode=Off /usr/local/php7/bin/php-cs-fixer-v2.phar $*
phpStorm设置
在代码文件右键 External Tool->php-cs-fixer
运行完出现You are running PHP CS Fixer with xdebug enabled,这个不用管。再看看你代码的变化。
/usr/local/php7/bin/php-cs-fixer fix /Users/xiong/Sites/kyYaf/application/controllers/Fund.php --rules=@PSR2
You are running PHP CS Fixer with xdebug enabled. This has a major impact on runtime performance.
If you need help while solving warnings, ask at https://gitter.im/PHP-CS-Fixer, we will help you!
Loaded config default.
Using cache file ".php_cs.cache".