doujiao1948 2014-08-20 09:13
浏览 723
已采纳

在PhpStorm中标记@see

I have the following code:

class A {

    /**
     * Splitter for words
     *
     * @var null|string
     */
    private $splitter = '-';

    /**
     * Desc...
     *
     * @param null|string $splitter   @see $splitter
     */
    function __construct(
        $splitter = null
    ) {
      // implementation
    }

}

$a = new A();

When using CTRL+Q in PhpStorm to see documentation for class constructor I will see:

null|string $splitter @see $splitter

Am I doing something wrong or should PhpStorm be configured to display description for $splitter here. I would expect here to have displayed Splitter for words or link to $splitter member and not just @see $splitter.

As I checked it doesn't matter that those 2 variables have the same name - even if constructor argument name would be $s PhpStorm still displays @see $splitter.

  • 写回答

1条回答 默认 最新

  • dongzhenge2014 2014-08-20 09:55
    关注

    First of all: when in-lined (like you did) the PHPDoc tag should be surrounded by {}, like this: @param null|string $splitter {@see $splitter}

    Secondly: PhpStorm does NOT parse additional/in-line tags in @param or @return descriptions -- it only parses it if @see is located on separate line or if in-lined in main (method) description section. In other words: in-lining in @param description will not work (very unfortunately).

    In this regard PhpStorm behaves just like PhpDocumentor itself (checked using version 2.6.1).

    Code:

    <?php
    
    class PHPDoc_See
    {
    
        /**
         * Splitter for words
         *
         * @var null|string
         */
        private $splitter = '-';
    
        /**
         * Desc...  {@see $splitter}
         *
         * @param null|string $splitter Bla-Bla {@see $splitter}
         */
        function __construct($splitter = null)
        {
            // implementation
        }
    }
    

    PhpDocumentor result:

    enter image description here

    In this regard PhpStorm behaves a bit better -- at least it parses @see in main (method) description.


    The only workable solution (as I see it) is to place @see tags on separate lines:

    /**
     * Some Description
     *
     * @param null|string $splitter Bla-Bla
     * @see $splitter
     */
    

    Of course: you can always submit Feature Request ticket to the PhpStorm's Issue Tracker (I would vote for it) .. but considering how PhpDocumentor is behaving in this regard .. I have serious doubts that PhpStorm devs will have it implemented any time soon (they do prefer following the same behaviour as referenced tool).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog