Netbeans php-cs-fixer 最终出现错误 "Files that were not fixed due to errors reported during linting after fixing:"

Netbeans php-cs-fixer end up with error "Files that were not fixed due to errors reported during linting after fixing:"

我在 Netbeans 8.2 中使用 php-cs-fixer 进行代码格式化。当我尝试格式化一个文件时,它显示错误

Files that were not fixed due to errors reported during linting after fixing:

我在许多网站上搜索了修复程序,但无法修复此问题。有没有什么办法解决这一问题?我尝试了 php-cs-fixer 1php-cs-fixer 2.

错误消息意味着 PHP CS Fixer 从驱动器加载了一些文件,对它们应用了更改,然后意识到这些更改后文件不再有效(无效的 PHP 语法),因此它决定不保存它。这是 PHP CS Fixer 的安全机制之一,不会破坏您的项目。

这意味着您发现 PHP CS Fixer 本身存在问题。 请确认您使用的是最新版本,也许错误已经修复!

如果没有,请考虑公开您的配置文件(如果有)和您在 https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/new 列出的文件的内容!

还有一个选项可以查看正在进行的操作。

$ ./vendor/bin/php-cs-fixer fix src/ErrorFile.php -vvv 

The --verbose option will show the applied rules. When using the txt format it will also display progress notifications.

NOTE: if there is an error like "errors reported during linting after fixing", you can use this to be even more verbose for debugging purpose

  • -v: verbose
  • -vv: very verbose
  • -vvv: debug