Opened 7 years ago
Closed 7 years ago
#41927 closed defect (bug) (fixed)
Twenty Seventeen: Missing @return in comment documentation
Reported by: | ndoublehwp | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 4.9 |
Component: | Bundled Theme | Keywords: | has-patch |
Focuses: | docs | Cc: |
Description
In the comment docs of function
twentyseventeen_video_controls()
, the @return is missing
Attachments (3)
Change History (13)
#1
@
7 years ago
- Keywords has-patch added
Hi ndoublehwp,
Nice catch ;)
Here is a patch to include inline doc before this function.
Regards,
Jb
#3
@
7 years ago
@truongwp ha? Ok. Is it better now? This is my very first step in inline doc so please let me know if anything is wrong :)
#4
@
7 years ago
@truongwp, usually we state what returns
though. So shouldn't it actually be @return Settings
or something similar on this instance?
Edit: @truongwp is correct. I guess I've missed it before... x_x
@audrasjb check this : https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/#4-hooks-actions-and-filters
#5
@
7 years ago
So @xkon @truongwp if I not misunderstand the handbook, there should not be any @return in inline documentation because filters always return their first parameter. Am I right?
#6
@
7 years ago
According to the Handbook
Quoting:
Note that @return
is not used for hook documentation, because action hooks return nothing, and filter hooks always return their first parameter.
So yes the original documentation was fine as it was since this is a filter
function.
#7
@
7 years ago
Hi,
This is inline docs for a function. Please see the example here: https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/#1-functions-class-methods
@return type Description.
or @return type
are correct, not @return type $var Description.
or @return Description.
In the comment docs of function twentyseventeen_video_controls(), the @return is missing