我有这个代码:
/**
* 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/