PHPDoc: @return void necessary?

前端 未结 6 1493
[愿得一人]
[愿得一人] 2020-12-07 17:13

Is it really necessary do something like this:

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

I have quite a few methods that don\'t have a return valu

6条回答
  •  囚心锁ツ
    2020-12-07 17:49

    As of php 7.1, void is a valid return type and can be enforced on a function.

    I would always add it on the docblock.

    Another benefit of writing it, is to differentiate the void methods from the methods that may return anything but don't have a @return entry on the docblock by negligence.

提交回复
热议问题