[TYPO3-dev] RFC: CGL change regarding return statements
Dmitry Dulepov
dmitry.dulepov at gmail.com
Fri Mar 11 09:08:43 CET 2011
Hi!
Andreas Wolf wrote:
> So what I propose is to drop the limitation to one return statement for
> all validation logic at the start of a method.
-1. Recently many functions were refactored for this. It improves readability.
One way to avoid this is to use smaller functions. This also creates
cleaner code. For example:
function foo($shouldRun) {
$result = false;
if ($shouldRun) {
$result = bar();
}
return $result;
}
function bar() {
return true;
}
--
Dmitry Dulepov
TYPO3 core&security team member
E-mail: dmitry.dulepov at typo3.org
Web: http://dmitry-dulepov.com/
More information about the TYPO3-dev
mailing list