phpDoc 类常量文档

发布于 2024-09-26 20:37:01 字数 45 浏览 1 评论 0原文

如何记录 phpDoc 的类常量?我已阅读手册,但找不到有关它们的任何内容。

How do I document class constants for phpDoc? I've read the manual but I can't find anything about them.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

滥情空心 2024-10-03 20:37:01

常量只需要一个包含描述的文档块。不需要特定的标签。代码解析器本身识别常量并在生成的文档中显示它们(这是一个示例)。

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).

森林迷了鹿 2024-10-03 20:37:01

我相当确定您可以使用 @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 shows define 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.

燕归巢 2024-10-03 20:37:01

所有 PHPDoc 3 标签的完整列表:标签参考

手册说明如下:

@var

您可以使用@var标签来记录以下类型
结构要素:

  • 常量,包括类范围和全局范围
  • 属性
  • 全局和局部范围的变量

The full list of all PHPDoc 3 tags: Tag reference

The manual says the following:

@var

You may use the @var tag to document the Type of the following
Structural Elements:

  • Constants, both class and global scope
  • Properties
  • Variables, both global and local scope
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文