PHPStorm – phpcbf as a file watcher
Install PHPCS locally via composer
composer req --dev squizlabs/php_codesniffer
Configure PHPStorm
- Go to
Preferences
Tools
->File Watchers
- Click
+
-> <custom> - Name:
PHPCBF
- File type:
PHP
- Scope:
Project Files
- Program:
$ProjectFileDir$/vendor/bin/phpcbf
- Arguments:
$FilePath$
- Uncheck
Auto-save edited files to trigger the watcher
- Uncheck
Trigger the watcher on external changes