phpdoc: What's the proper way to document a constant

Deadly 提交于 2019-12-01 18:19:35

phpDocumentor does not recognize or utilize a @const tag. phpDocumentor recognizes a constant when it sees the "define" keyword in the code. Its output templates will show all constants in the output documentation, listed as constants. The only thing needed in the constant's docblock is a description, although many other "standard" tags are allowed if you feel like you need them [1].

[1] -- http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_elements.pkg.html#procedural.define

Use @const.

/**
  * @const FOO Bar
  */
define('FOO', 'Bar');

Documentation (Sorry, the only docs I can find are in German.)

Travis Smith

You actually want to use @type, see the Github PHP Documentation.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!