Skip to content

Instantly share code, notes, and snippets.

@koriym
Forked from Piskvor/phpstan-check-on-save.md
Created May 22, 2020 05:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koriym/055aa956af99f93368ee354a57135094 to your computer and use it in GitHub Desktop.
Save koriym/055aa956af99f93368ee354a57135094 to your computer and use it in GitHub Desktop.
Make PhpStorm check the current PHP file on save.

PhpStorm + PhpStan watcher

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
  • Output filters: Failed to save key (else you'll get zillion cache notices)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment