views:

58

answers:

3

Hi, which is the correct way to document class constants for phpDoc? I've read the manual but i can't find anything about them

+1  A: 

Hi,

I've found in the manual that they are detected automatically. So you probably don't have to do anything special about them, apart from adding the @var tag.

Alin Purcaru
But the @var tag is for class properties...Are you sure that constants and properties have the same tag?
mck89
constants are *constant class properties* as opposed to *variable class properties*
Alin Purcaru
Can you give me the link of that page?
mck89
*Inheritance information, polymorphism and constants are all recognized automatically.* Somewhere in here http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_phpDocumentor.quickstart.pkg.html
Alin Purcaru
+2  A: 

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.

lonesomeday
I don't know why it's not documented but it seems to work, thanks...
mck89
+1  A: 

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 [1]).

[1] -- http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/Parsers/_phpDocumentor---TutorialHighlightParser.inc.html#sec-constants

ashnazg