[TYPO3-dev] CGL question

Steffen Müller typo3 at t3node.com
Wed Feb 26 14:23:51 CET 2014


Hi.

On 26.02.2014 12:50 Dmitry Dulepov wrote:
> What is you opinion: does example #1 violate CGL or not?

CGL says "a function can return during parameter validation before it
starts its main logic". [1]
CGL does not say "_function_ parameter validation". So IMO your case
does not violate CGL. Btw, "function parameter" is usually referred to
as "function argument" in PHP. [2]

However I suggest to change CGL to allow early returns, if they make
unit testing less complex or lead to significant performance increasements.
What do you think?

[1]
http://docs.typo3.org/TYPO3/CodingGuidelinesReference/PhpFileFormatting/PhpSyntaxFormatting/Index.html#functions
[2] http://www.php.net/manual/en/functions.arguments.php

-- 
cheers,
Steffen

Active Contributor TYPO3 CMS

TYPO3 Blog: http://www.t3node.com/
Twitter: @t3node - http://twitter.com/t3node



More information about the TYPO3-dev mailing list