php - 为常量编写 PHPDocs 的正确方法是什么?

标签 php phpdoc

我有这个代码:

/**
 * Days to parse
 * @var int
 */
const DAYS_TO_PARSE = 10;
...

我不认为使用 @var 对常量是正确的,我没有看到任何 @constant PHPDoc 标记。这样做的正确方法是什么?

最佳答案

The PHP-FIG suggests using @var for constants.

7.22. @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

Syntax

@var ["Type"] [element_name] [<description>]

关于php - 为常量编写 PHPDocs 的正确方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6706051/

相关文章:

PHPDoc 创建/修改日期/时间戳

PHPDocumentor 可选参数

php - 使用简单的 JSON 数组制作 Doctrine 查询结果

php - iCalendar 邀请未在电子邮件客户端中显示 RSVP 按钮

php - 在 yii 中使用 CSqlDataProvider 进行排序

phpstorm - @internal 实际上是什么意思以及如何使用它?

netbeans - phpdoc 建议 $this->someField 的类型

phpDocumentor 如何记录字符串参数的可用选项

php - 有效管理数据变更

PHP fatal error : Cannot use object of type simple_html_dom as array