# PHPStan
PHPStan runs static analysis for your code without running it. To check the code running following:
sail composer phpstan
Command will output all errors for you
# Usage in PHPStorm
PHPStorm has support for PHPStan as quality tool.
Important: To configure it first make sure that you set up PHPStorm's PHP interpreter correctly.
Open Preferences... > PHP > Quality tools > PHPStan, click ... on the right side of Configuration:.

If you only see Local configuration then click + choose Docker based PHP Interpreter.
If PHPStorm does not automatically detect PHPStan path then add it manually: /var/www/html/vendor/bin/phpstan

Click Validate, if everything is correct you should be able to see "OK" message down below.
Next, click PHPStan inspection link, it will open up PHPStorm's inspections configuration.
Tick PHPStan validation, on the left side enter Level as 8 and choose phpstan.neon file from project's root directory as Configuration file

Click OK on all windows and close
Lastly, make sure you on Preferences... > PHP > Quality tools > PHPStan > Configuration: correct PHP Interpreter is selected
Now everytime PHPStorm notices PHPStan rule violation it will show a "warning" message.
← PHP CS Fixer PHPUnit →