News

PHPStan and Psalm Support Coming to PhpStorm Soon

The popular static analyzers PHPStan and Psalm will soon be supported in PhpStorm. Even better, the code behind this support will be open source.

It’s always been possible to run PHPStan and Psalm as external tools. Now that we see significant interest in the tools among the community, we’d like to improve your experience of using them in PhpStorm.


Source: JetBrains Developer Ecosystem Survey Report.

What’s implemented

First, we’ve focused on making PHPStan and Psalm work as first-class quality tools in PhpStorm.

  • Both work just like all other quality tools, with on-the-fly file highlighting and the ability to batch-run inspections.
  • They can be run via remote interpreters such as Docker, WSL, and others.
  • PHPStan and Psalm settings in composer.json are detected automatically.
  • The settings for PHPStan and Psalm can be configured in the corresponding inspection options.

What’s coming

We plan to add support for Psalm annotations in PhpStorm code analysis. This feature is still in the early stages of development, and we will roll out support gradually starting with the most popular tags.

Another big part is support for array key and value types. This one is also under heavy development.

This is all open-source

We’ve decided to decouple the support of PHPStan and Psalm into separate plugins. Both are open-source and are already available on GitHub under the Apache 2 license:

https://github.com/JetBrains/phpstorm-psalm-plugin
https://github.com/JetBrains/phpstorm-phpstan-plugin

The community is welcome to participate and help improve the IDE’s support for these static analysis tools.

On the other hand, these plugins can be seen as a reference example and a source of inspiration for your own plugins. For example, you can create support for your favorite tool in PhpStorm, such as the Pest IntelliJ plugin for Pest. Or you could even make a commercial solution such as Laravel Idea.

If you’re considering developing a paid plugin, keep in mind that JetBrains provides the Marketplace platform which helps plugin vendors deliver their plugins to a wider audience, and takes care of things like payments for a modest fee.

When will this be available to try?

The plugins are most likely to be bundled with PhpStorm 2020.3 and enabled by default. This means it will be possible to try the support around September when the Early Access Program for 2020.3 starts.

⚠️ Please note that while the plugins’ source code is already available, it will not work with PhpStorm 2020.1 or 2020.2.


That’s all for today. We are eager to hear what you think about this!

Your JetBrains PhpStorm team
The Drive to Develop

image description