PhpStorm 配置 PHP CS Fixer
打赏作者

taizujunshang

这个不错, 就是好长时间不更新了

Nixus

配置好后,执行的时候,报了个错误:
Cannot start process, the working directory '/Users/Nixus/Valet/first-app/tests:/Users/Nixus/Valet/first-app/app' does not exist
错误提示

Nixus

解决了,
Working Directory 中,把$Projectpath$ 换成了 $ProjectFileDir$ 就可以了!
在查资料的时候,发现了一个保存时自动执行的某些操作的方法
就是利用Tools->Files Watchers 来实现的,当保存时,自动执行 php-cs-fixer

JellyBool 回复 Nixus

这个可以,非常不错。

Nixus 回复 JellyBool

这个有一个神烦的问题:File cache conflict,经常弹出这个,然后如果刚好按到了回车,代码就被改掉了,还要不停的撤回

JellyBool 回复 Nixus

这个我倒是没有遇到过

Nixus 回复 JellyBool

Files Watchers 会有这个问题了!网上查了一下,无解

dope2008

Please use the fully-qualified name e.g. josegonzalez/php/php53 to refer the formula.
Error: Invalid formula: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-php/Formula/php-cs-fixer.rb
Formulae found in multiple taps:
* josegonzalez/php/php53
* homebrew/php/php53

Please use the fully-qualified name e.g. josegonzalez/php/php53 to refer the formula.
Error: Invalid formula: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-php/Formula/php-code-sniffer@2.9.rb
Formulae found in multiple taps:
* josegonzalez/php/php53
* homebrew/php/php53

Please use the fully-qualified name e.g. josegonzalez/php/php53 to refer the formula.
Error: Invalid formula: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-php/Formula/phpunit.rb
Formulae found in multiple taps:
* josegonzalez/php/php53
* homebrew/php/php53

Please use the fully-qualified name e.g. josegonzalez/php/php53 to refer the formula.
Error: Cannot tap homebrew/php: invalid syntax in tap!

JellyBool 回复 dope2008

brew install homebrew/php/php53

话说为啥还 5.3.。。

dope2008 回复 JellyBool

不知道,安装不了,我直接是brew install homebrew/php/php-cs-fixer…php -v 是7.1的

smile2017

感觉这个功能 PHPStorm本身就提供了啊

PHPStorm Setting > Edit > Code Style > PHP配置

去除无用的use可以使用PHPStorm的 Code > Optimize Imports

为什么还要加载一个外部的处理程序呢

JellyBool 回复 smile2017

阔以,学习了

Roach.cn

option+control+O 就可以了啊,phpstorm 内置。