doufenzhu7012 2013-08-07 21:34
浏览 32
已采纳

在另一个文件中扩展PHPDoc / PHPStorm文档

I have a class (which I'll call Example) which implements the __call() method. This method allows the class to be extended to have additional calls (based on other data). For this question, I'll assume one of those is getDemoData().

This getDemoData() function would be available if it had a value in an array with a key Demo. The return value would be a specific class, in this case, named Demo.

Is it possible to some how extend the PHPDoc documentation (either due to PHPDoc directly, or something special in PHPStorm itself) which would allow me to say in Demo that Example has a method named Example::getDemoData().

I know I can use the @method tag from within the class itself, but I don't know if I can use it outside of that class (if I can, I'm not sure the syntax).

Thanks.

  • 写回答

1条回答 默认 最新

  • dongmou2389 2013-08-08 15:05
    关注

    I think the best you can do in that scenario is to use the @see tag in Demo's class docblock:

    /**
     * @see Example::getDemoData()
     */
    class Demo {}
    

    assuming that you did indeed put @method in Example's class docblock:

    /**
     * @method Demo getDemoData()
     */
    class Example {}
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?