[wp-trac] [WordPress Trac] #25450: remove_role() - invalid return statement
WordPress Trac
noreply at wordpress.org
Mon Sep 30 19:52:37 UTC 2013
#25450: remove_role() - invalid return statement
--------------------------+------------------------------
Reporter: tivnet | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Users | Version: 2.0
Severity: trivial | Resolution:
Keywords: has-patch |
--------------------------+------------------------------
Comment (by tivnet):
Replying to [comment:3 nacin]:
In any case, returns should be consistent. It's pretty ugly when a
function that should return a string, suddenly in the middle has `if(...)
return;`
Even those methods having `$echo = true` parameters, in my opinion, should
return something if echoed.
{{{
if ( $echo )
echo $var; // returned null, inconsistent
else
return $var;
}}}
I'd write as:
{{{
if ( $echo )
echo $var;
return $var; // consistent, whether you want to use it or not
}}}
Anyway, what about my patch? Approved, in general? Because I can submit
more like this. Please let me know. Thank you!
--
Ticket URL: <http://core.trac.wordpress.org/ticket/25450#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list