【问题标题】:Phan giving problems with built-in JetBrains PhpStorm annotationsPhan 给出内置 JetBrains PhpStorm 注释的问题
【发布时间】:2021-06-22 09:54:18
【问题描述】:

我对@9​​87654321@ 中描述的新的 PhpStorm 内置注释有疑问

这是代码:

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

当我现在运行我的 Phan 静态分析器时,我收到以下错误:

PhanUndeclaredClassAttribute 对属性中未声明类 \JetBrains\PhpStorm\NoReturn 的引用

我该如何解决这个问题?我是否必须作曲家从 JetBrains 安装一些库才能在我的代码库中包含这些注释?

【问题讨论】:

    标签: php phpstorm


    【解决方案1】:

    是的,请参阅https://github.com/JetBrains/phpstorm-attributes

    这些属性在 PhpStorm 2020.3 及更高版本中可用。它们与 PhpStorm 捆绑在一起,因此您无需单独安装它们。

    如果您正在使用其他静态分析工具并且不想出现 Class not found 问题,那么您可能希望将属性包添加到您的 composer.json 作为开发依赖项:

    composer require --dev jetbrains/phpstorm-attributes
    

    【讨论】:

      猜你喜欢
      • 2016-04-09
      • 2011-11-04
      • 2010-09-23
      • 2021-03-24
      • 1970-01-01
      • 2017-08-20
      • 2013-07-31
      • 1970-01-01
      相关资源
      最近更新 更多