phpDoc class constants documentation

给你一囗甜甜゛ 提交于 2019-11-27 03:05:36

问题


How do I document class constants for phpDoc? I've read the manual but I can't find anything about them.


回答1:


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.


Nine years later, an edit...

It is clear now that the above is bad advice as @const has not appeared in the docs and it seems it will not.

Using @var seems to work, though I cannot see it explicitly specified anywhere.




回答2:


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).



来源:https://stackoverflow.com/questions/3892063/phpdoc-class-constants-documentation

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