PHP—CS—Fixer
定义:PHP 编码格式化工具
安装:
curl -L https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.0.0/php-cs-fixer.phar -o php-cs-fixerchmoda+x php-cs-fixer
chmod a+x php-cs-fixer
mv php-cs-fixer /usr/local/bin/php-cs-fixer
在命令行执行php-cs-fixer,看到这个及表示安装成功

使用:
写个test.php文件测试一下:

执行:php-cs-fix fix(F) test.php ,也可以自己定义php代码的风格,要编写.php_cs文件,执行的时候指定下php-cs-fix fix --config=.php_cs test.php。可见它会进行换行处理,但并不会修改常量的大小写的规范问题,只是格式用,不要完全依赖。

网友评论