IntelliJ IDEA
 
Get IntelliJ IDEA
You are viewing the documentation for an earlier version of IntelliJ IDEA.

PHPStan

Last modified: 21 June 2023

IntelliJ IDEA provides code quality check through integration with the PHPStan tool, which validates your code for consistency against a set of validation rules.

To use PHPStan from IntelliJ IDEA instead of command line, you need to register it in IntelliJ IDEA and set it up as a IntelliJ IDEA code inspection. Once installed and enabled in IntelliJ IDEA, 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. When the tool is run in the batch mode, the errors and warnings are displayed in the Problems tool window. Each message has a phpstan prefix to distinguish it from IntelliJ IDEA internal inspections.

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