PhpStorm - Settings - Tools - File Watchers (create new)
- File type:
PHP
- Scope:
Project files
- Program (wherever your phpstan is located, obvs.):
$ContentRoot$/vendor/phpstan/phpstan/bin/phpstan
- Arguments:
analyse $FilePath$
- Working directory (this is probably the directory with phpstan.neon):
$ContentRoot$
- Show console: on error