phpDoc 类常量文档
如何记录 phpDoc 的类常量?我已阅读手册,但找不到有关它们的任何内容。
How do I document class constants for phpDoc? I've read the manual but I can't find anything about them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
常量只需要一个包含描述的文档块。不需要特定的标签。代码解析器本身识别常量并在生成的文档中显示它们(这是一个示例)。
Constants only need a docblock that contains the description. No specific tag is necessary. The code parser itself identifies constants and displays them as such in the generated documentation (here's an example).
我相当确定您可以使用
@const
,尽管我找不到任何英文文档。 这里有一个德语示例。它显示define
语句而不是类常量,但 IIRC 语法是相同的。九年后,一次编辑......
现在很明显,上面的建议是坏,因为
@const
还没有出现在文档中,而且似乎也不会出现。使用
@var
似乎可以工作,尽管我看不到它在任何地方明确指定。I'm fairly sure that you can use
@const
, though I can't find any English documentation. There's a German example here. It showsdefine
statements rather than class constants, but IIRC the syntax is the same.Nine years later, an edit...
It is clear now that the above is bad advice as
@const
has not appeared in the docs and it seems it will not.Using
@var
seems to work, though I cannot see it explicitly specified anywhere.所有 PHPDoc 3 标签的完整列表:标签参考
手册说明如下:
The full list of all PHPDoc 3 tags: Tag reference
The manual says the following: