PHPStan Support

Wednesday September 26, 2018

Hi all. Today, we will show you about PHPStan integration which will be available in the next NetBeans version i.e. NetBeans 10 as a new code analysis feature.

If you have already used other code analysis features(e.g. Code Sniffer), you should be able to use this with similar way soon.

Options

First of all, let’s set the Options (Tools > Options > PHP > Code Analysis > PHPStan). You can set a script path, a configuration file path and a level. At least you have to set the PHPStan script path to "PHPStan". If you don’t set "Configuration" path, the configuration file of project root directory would be used.

phpstan support1

Inspect project/directory/file

Then, let’s inspect a project/direcoty/file using PHPStan. Please click "Source > Inspect…​". The inspect dialog is shown.

phpstan support2

Please choose "Scope" which you would like to inspect and PHPStan as "Configuration". The files are inspected when you click the "inspect" button. Finally, The results are shown in the inspector window after the inspection is done.

phpstan support3

That’s all for today. As always, please test it. You can download a development version from Jenkins Build. If you find some issues or enhancements, please report them to JIRA (Components: php - Code). Thanks.