The PHP Coding Standards Fixer (PHP CS Fixer) tool fixes your code to follow standards.

工作环境:MacBook。

打开 PhpStorm Preferences > Tools > External Tools 添加:

Preferences > Tools > External Tools

  • Program: /usr/local/bin/php-cs-fixer
  • Parameters: --rules=@Symfony --verbose fix "$FileDir$/$FileName$"(Note that previous verions of PHP-CS-Fixer used –levels instead of –rules. 未找到)
  • Working directory: $ProjectFileDir$
  • 我取消勾选了 Open console,可以不输出日志信息

设置快捷键 Preferences > Keymap

Preferences > Keymap

相关阅读:

References: