使用类级别的PHPDoc注释-特别是 @method 标记-在PhpStorm中可以正常工作:
abstract class a {...在上面:
@method
-PHPDoc标签static
-告诉您这是静态方法someClass
或$this
-返回类型get_by_user_id
-方法名称(int $id)
-方法签名:([[type] [parameter]<, ...>])
Bla-bla
-一些可选的描述
有关更多
@method:
- https://docs.phpdoc.org/latest/references/phpdoc/tags/method.html
- https://github.com/phpdocumentor/phpdocumentor2/blob/develop/docs/PSR.md#711-方法
PS 虽然
@methodstatic在PhpStorm中工作正常(告诉IDE该方法是静态的),但实际的phpdocumentor工具可能还不支持(还好吗?)(对不起,有一段时间没有使用它了)。
另外一种方法 :(当然是在PhpStorm中)
Settings | Inspections | PHP | Undefined |Undefined method --> Downgrade severity if __magic methods are present inclass-它不会以任何方式帮助此类方法的代码完成,但是不会将那些魔术方法标记为“未定义方法”错误。
phpdocumentor的 关于
@property/
@method标签使用RegEx /部分名称 的票据
(如何处理文档以及在处理代码完成时对实际IDE的帮助很少):
- https://github.com/phpdocumentor/phpdocumentor2/issues/689



