php - PHPDoc: @return void necessary? -


is necessary this:

/**  * ...  *   * @return void  */ 

i have quite few methods don't have return value, , seems redundant put in comment. considered bad form leave out?

if makes clear documentation, leave in, isn't strictly necessary. it's entirely subjective decision.

personally, leave out.

edit
stand corrected. after little googling, wikipedia page says:

@return [type description] tag should not used constructors or methods defined void return type.

the phpdoc.org website says:

@return datatype description
@return datatype1|datatype2 description

the @return tag used document return value of functions or methods. @returns alias @return support tag formats of other automatic documentors

the datatype should valid php type (int, string, bool, etc), class name type of object returned, or "mixed". if want explicitly show multiple possible return types, list them pipe-delimited without spaces (e.g. "@return int|string"). if class name used datatype in @return tag, phpdocumentor automatically create link class's documentation. in addition, if function returns multiple possible values, separate them using | character, , phpdocumentor parse out class names in return value. phpdocumentor display optional description unmodified.

sooo... based on that, leave out void. it's non-standard, @ least.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -