Reputation: 34543
Is there a proper way to document a constant defined using define()
? @var doesn't really make sense. The only thing I can think of is to omit the tag, and just write the description in the PHPdoc comment.
Upvotes: 6
Views: 5709
Reputation: 1606
My version of phpDocumentor (2.9.0) actually shows text if you don't use any tag at all and write the text directly. Though, it's treated like a function/method header: first line is a summary and everything else is the description.
/**
* The meaning of life.
*/
const MYSTERY = 42;
Furthermore, I can confirm that @const
and @type
"work" in that the text appears in a sidebar under "Tags" – rather than directly underneath the constant in the main column.
Upvotes: 1
Reputation: 538
You actually want to use @type
, see the Github PHP Documentation.
Upvotes: 1
Reputation: 6688
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].
Upvotes: 6
Reputation: 238115
Use @const
.
/**
* @const FOO Bar
*/
define('FOO', 'Bar');
Documentation (Sorry, the only docs I can find are in German.)
Upvotes: 1