[wp-trac] [WordPress Trac] #27098: Bundled Themes: ditch all uses of `@return void`
WordPress Trac
noreply at wordpress.org
Mon Mar 24 17:15:52 UTC 2014
#27098: Bundled Themes: ditch all uses of `@return void`
-------------------------------+---------------------
Reporter: philiparthurmoore | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 3.9
Component: Bundled Theme | Version: trunk
Severity: normal | Resolution: fixed
Keywords: has-patch | Focuses: docs
-------------------------------+---------------------
Comment (by jond3r):
Replying to [comment:21 GaryJ]:
This is interesting.
When I read the documentation about the return statement on php.net (your
link above), it does say that {{{NULL}}} is returned: both if no return
statement is given, and for a {{{return}}} without an argument.
I have a background in C/C++, where this is not true: {{{void}}} is
returned in those cases. In C/C++ {{{void}}} is very distinct from
{{{NULL}}} (literally 'nothing' versus the pointer address NULL (often
defined as the integer 0)). In PHP, {{{NULL}}} apparently is a special
value distinct from the integer 0. I had somewhat casually assumed that
PHP followed C/C++ in this regard. Apparently not.
On the other hand, I might be correct anyway about the //documentation//
of the {{{return}}} value. Reading the documentation of phpDoc
http://www.phpdoc.org/docs/latest/references/phpdoc/types.html , under the
section 'Keyword': '9. void' and '10. null', which I actually had read and
which I based my comments above on, it seems that {{{@return void}}}
should be used either if no return statement is given or if {{{return}}}
without an argument is used.
So the interesting point here is that phpDocumentor sets itself apart from
php.net and more adheres to the standard of C/C++ (and Java for that
matter).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27098#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list