Phan 给出内置 JetBrains PhpStorm 注释的问题

Phan giving problems with built-in JetBrains PhpStorm annotations

我对 https://blog.jetbrains.com/phpstorm/2020/10/phpstorm-2020-3-eap-4/

中描述的新 PhpStorm 内置注释有疑问

这是代码:

use JetBrains\PhpStorm\NoReturn;
#[NoReturn] public function __construct() {}

现在 运行 我的 Phan 静态分析器出现以下错误:

PhanUndeclaredClassAttribute Reference to undeclared class \JetBrains\PhpStorm\NoReturn in an attribute

我该如何解决这个问题?我是否必须 composer 从 JetBrains 安装一些库才能在我的代码库中添加这些注释?

是的,见https://github.com/JetBrains/phpstorm-attributes

The attributes are available in PhpStorm 2020.3 and later. They are bundled with PhpStorm so you don’t need to install them separately.

If you are using other static analysis tools and don’t want to get Class not found issues, then you might want to add the attributes package to your composer.json as a dev dependency:

composer require --dev jetbrains/phpstorm-attributes