[wp-trac] [WordPress Trac] #44450: Functions/methods do not return any value in classes should use @return void in method doc

WordPress Trac noreply at wordpress.org
Mon Jan 21 21:58:03 UTC 2019


#44450: Functions/methods do not return any value in classes should use @return
void in method doc
-------------------------------------+-------------------------------------
 Reporter:  subrataemfluence         |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Future Release
Component:  Widgets                  |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-refresh  |     Focuses:  docs, coding-standards
-------------------------------------+-------------------------------------

Comment (by DrewAPicture):

 The current standard for omitting `@return void` still stands in core,
 though with the acceptance of void as a type in PHP7+ I'd be in favor of
 discussing an optional reversal of the current policy of omission.

 I know the issue has been raised by @jrf previously (in favor of requiring
 `@return` notations on all the things) though I'm not sure I'm in favor of
 swinging from one extreme to another. That's a lot of code to update in
 core and assuming the wpcs follows suit, anybody who's been following that
 lead.

 I'll close by simply saying that Idon't love the idea of requiring things
 purely in the name of completeness. We currently omit `@return` notations
 for things that don't return and require them for things that do. I'm not
 sure what virtue there is in documenting that nothing gets returned.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44450#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list