WordPress.org

Make WordPress Core

Opened 4 weeks ago

Last modified 4 weeks ago

#44450 new defect (bug)

Functions/methods do not return any value in classes should use @return void in method doc

Reported by: subrataemfluence Owned by:
Milestone: 5.0 Priority: normal
Severity: normal Version: trunk
Component: Widgets Keywords: has-patch
Focuses: docs, coding-standards Cc:

Description

Several classes inside wp-includes/widgets directory are missing @return void in function docs which are echo-ing output but not returning any value.

There are many other areas in the core which are using this approach. We need to be consistent.

Attachments (2)

44450.diff (4.1 KB) - added by subrataemfluence 4 weeks ago.
Proposed patch
44450-2.diff (4.1 KB) - added by subrataemfluence 4 weeks ago.
Please ignore the last one. Wrong patch uploaded by mistake. Uploading modified patch.

Download all attachments as: .zip

Change History (6)

@subrataemfluence
4 weeks ago

Proposed patch

@subrataemfluence
4 weeks ago

Please ignore the last one. Wrong patch uploaded by mistake. Uploading modified patch.

#1 @subrataemfluence
4 weeks ago

  • Keywords has-patch added; needs-patch removed

#2 @subrataemfluence
4 weeks ago

  • Summary changed from Functions/methods do not return any value in classes should use @return void. to Functions/methods do not return any value in classes should use @return void in method doc

#3 @netweb
4 weeks ago

  • Milestone changed from Awaiting Review to 5.0

#4 in reply to: ↑ description @pbiron
4 weeks ago

Replying to subrataemfluence:

There are many other areas in the core which are using this approach. We need to be consistent.

The vast majority of core does not use @return void when it applies, presumably because the DocBlock Formating: Functions & Class Methods section of the handbook specifically says:

@return: Should contain all possible return types, and a description for each. Use a period at the end. Note: @return void should not be used outside of the default bundled themes.

But I whole-heartedly agree that @return void should be used everywhere it applies!

p.s. thank you so much for all of the DocBlock-related tickets you've been creating lately!

Note: See TracTickets for help on using tickets.