{"id":56033,"date":"2020-07-08T12:44:42","date_gmt":"2020-07-08T12:44:42","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=phpstorm&#038;p=56033"},"modified":"2020-07-08T12:56:38","modified_gmt":"2020-07-08T12:56:38","slug":"phpstan-and-psalm-support-coming-to-phpstorm","status":"publish","type":"phpstorm","link":"https:\/\/blog.jetbrains.com\/zh-hans\/phpstorm\/2020\/07\/phpstan-and-psalm-support-coming-to-phpstorm","title":{"rendered":"PHPStan and Psalm Support Coming to PhpStorm Soon"},"content":{"rendered":"<p>The popular static analyzers PHPStan and Psalm will soon be supported in PhpStorm. Even better, the code behind this support will be open source.<\/p>\n<p><!--more--><\/p>\n<p>It\u2019s always been possible to run <a href=\"https:\/\/github.com\/phpstan\/phpstan\" target=\"_blank\" rel=\"noopener\">PHPStan<\/a> and <a href=\"https:\/\/github.com\/vimeo\/psalm\" target=\"_blank\" rel=\"noopener\">Psalm<\/a> as external tools. Now that we see significant interest in the tools among the community, we\u2019d like to improve your experience of using them in PhpStorm.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2020\/07\/quality_tools_stats.png\" class=\"alignnone wp-image-55896\" alt=\"\" width=\"658\" \/><br \/>\n<em style=\"\">Source: <a href=\"https:\/\/www.jetbrains.com\/lp\/devecosystem-2020\/php\/#:~:text=What%20additional%20quality%20tools%20do%20you%20use%20regularly%2C%20if%20any%3F\" target=\"_blank\" rel=\"noopener\">JetBrains Developer Ecosystem Survey Report<\/a>.<\/em><\/p>\n<h2 id=\"what_s_implemented\">What\u2019s implemented<\/h2>\n<p>First, we\u2019ve focused on making PHPStan and Psalm work as first-class quality tools in PhpStorm.<\/p>\n<ul>\n<li>Both work just like all other quality tools, with on-the-fly file highlighting and the ability to batch-run inspections.<\/li>\n<li>They can be run via remote interpreters such as Docker, WSL, and others.<\/li>\n<li>PHPStan and Psalm settings in composer.json are detected automatically.<\/li>\n<li>The settings for PHPStan and Psalm can be configured in the corresponding inspection options.<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2020\/07\/psalm_inspection_02.png\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2020\/07\/psalm_inspection_02.gif\" class=\"alignleft size-full wp-image-56002\" alt=\"\" width=\"808\" \/><\/p>\n<h2 id=\"what_s_coming\">What\u2019s coming<\/h2>\n<p>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.<\/p>\n<p>Another big part is support for array key and value types. This one is also under heavy development.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2020\/07\/array_shapes.png\" class=\"alignnone wp-image-55927\" alt=\"\" width=\"598\" \/><\/p>\n<h2 id=\"this_is_all_open_source\">This is all open-source<\/h2>\n<p>We\u2019ve 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:<\/p>\n<p><a href=\"https:\/\/github.com\/JetBrains\/phpstorm-psalm-plugin\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/JetBrains\/phpstorm-psalm-plugin<\/a><br \/>\n<a href=\"https:\/\/github.com\/JetBrains\/phpstorm-phpstan-plugin\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/JetBrains\/phpstorm-phpstan-plugin<\/a><\/p>\n<p>The community is welcome to participate and help improve the IDE\u2019s support for these static analysis tools.<\/p>\n<p>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 <a href=\"https:\/\/github.com\/pestphp\/pest-intellij \" target=\"_blank\" rel=\"noopener\">Pest IntelliJ<\/a> plugin for <a href=\"https:\/\/github.com\/pestphp\/pest\" target=\"_blank\" rel=\"noopener\">Pest<\/a>. Or you could even make a commercial solution such as <a href=\"https:\/\/plugins.jetbrains.com\/plugin\/13441-laravel-idea\" target=\"_blank\" rel=\"noopener\">Laravel Idea<\/a>. <\/p>\n<p>If you\u2019re considering developing a paid plugin, keep in mind that JetBrains provides the <a href=\"https:\/\/plugins.jetbrains.com\/marketplace\" target=\"_blank\" rel=\"noopener\">Marketplace<\/a> platform which helps plugin vendors deliver their plugins to a wider audience, and takes care of things like payments for a modest fee.<\/p>\n<h2 id=\"when_will_this_be_available_to_try\">When will this be available to try?<\/h2>\n<p>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.<\/p>\n<p>&#x26a0;&#xfe0f; Please note that while the plugins\u2019 source code is already available, it will not work with PhpStorm 2020.1 or 2020.2.<\/p>\n<hr>\n<p>That\u2019s all for today. We are eager to hear what you think about this!<\/p>\n<p>Your JetBrains PhpStorm team<br \/>\n<em>The Drive to Develop<\/em><\/p>\n","protected":false},"author":869,"featured_media":55917,"comment_status":"open","ping_status":"closed","template":"","categories":[89],"tags":[6201,6202,2615,2538],"cross-post-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/phpstorm\/56033"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/phpstorm"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/types\/phpstorm"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/users\/869"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/comments?post=56033"}],"version-history":[{"count":0,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/phpstorm\/56033\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media\/55917"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/media?parent=56033"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/categories?post=56033"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/tags?post=56033"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/zh-hans\/wp-json\/wp\/v2\/cross-post-tag?post=56033"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}