How does one document class attributes using Doxygen?
-
29-09-2019 - |
Question
I'm attempting to document class attributes using Doxygen. Currently, the protected attributes show up in the list at the top of the page for the specific class. I'd like to put an explanation for them.
I've tried using @param [name] [description]
both above the beginning of the class and right above the declaration of the attributes. I even tried putting them into the docblock for my constructor class and it just broke it.
Is there something I'm just missing?
-- Logan
Solution
You have to use <
or comment right before the attribute:
class cMainData
{
private $attr; //!< This is my attribute
//! This is another attribute
private $otherAttr;
}
Note that you can use @brief, @note and similar e.g.:
class cMainData
{
private $attr; //!<@brief This is my attribute.
//!< This is some additional info about this attribute.
}
OTHER TIPS
I've posted a workaround as an answer to a duplicate of this question: Doxygen: how to describe class member variables in php? It may be useful to link it from here for others that need solution compatible with phpDoc annotation style.