Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Is it impossible to document non-existant class variables in Doxygen? I tried a naked</p> <pre><code>/** @var User::email string * Email address */ </code></pre> <p>without a corresponding <code>$email;</code> member variable in the class, but Doxygen valiantly ignored that. I didn't find a command or something to force a documentation of a missing artifact.</p> <p>Therefore I experimented with <strong>creativedutchmen</strong>'s suggestion, however Paris does not cope well with already existing member variables, because – I think – the PHP magic method <code>__get()</code> does not get triggered anymore. I see three possible fixes:</p> <ol> <li><code>unset()</code> the documented member variables in the constructor. With <code>get_class_vars(get_class($this))</code> this could be done in a parent class. Because my model classes all inherit from a parent class, this would be relatively straightforward.</li> <li>Modify Paris to ignore already set member variables, but I do not see how without <code>unset()</code>.</li> <li>Name the member variables slightly differently, like appending an underscore, so they don't conflict with the dynamic variables.</li> </ol> <p>Horrible kludges. To do something at runtime or have additional members to make documentation possible? No thanks.</p> <p>I decided to leave the situation as-is and document the model factory methods carefully instead. Most of the time the factory methods contains as parameters the class variables to be able to set them. And even if the factory method does not set all class variables, it is possible to document the missing variables in prose. The class documentation is also a good alternative.</p> <p>I award the bounty to <strong>creativedutchmen</strong> because of thinking out of the box, even if it didn't help me in the end and because I don't want the reputation points to get lost.</p> <p><strong>tl;dr</strong></p> <p><em>Don't kludge. Document dynamic member variables in the factory method or in the class overview.</em></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload