PhpStorm
 
Get PhpStorm

PHPStan

Last modified: 25 November 2024

PhpStorm provides code quality checks through integration with the PHPStan tool or its Laravel extension Larastan. Both tools validate your code for consistency against a set of validation rules.

To use PHPStan or Larastan from PhpStorm instead of the command line, you need to register it in PhpStorm and set it up as a PhpStorm code inspection. Once installed and enabled in PhpStorm, the tool is available in any opened PHP file, and no additional steps are required to launch it. The on-the-fly code check is activated upon every update in the file thus making it easy to get rid of discovered problems.

Errors and warnings reported by PHPStan on the fly are highlighted in the editor in the same way as errors and warnings from PhpStorm's internal code inspections. When the tool is run in batch mode, the errors and warnings are displayed in the Problems tool window. Each message has a phpstan prefix to distinguish it from PhpStorm internal inspections.

The integration is implemented via the open-source PHPStan plugin. This plugin is bundled with PhpStorm and is enabled by default.