[TYPO3-mvc] Strange code in QOM_Statement and QueryObjectModel
Sebastian Fischer
typo3 at fischer.im
Fri Feb 5 07:55:06 CET 2010
Hi everyone,
i stumbled upon some code i don't understand uses call by reference
QOM_Statement uses
/**
* Does nothing
*
* @param array &$boundVariables
* @return void
*/
public function collectBoundVariableNames(&$boundVariables) {
$boundVariables = $this->boundVariables;
}
QueryObjectModel uses
if ($this->constraint !== NULL) {
$this->constraint->collectBoundVariableNames($this->boundVariables);
}
As you can see here call by reference isn't realy needed. Just return
the $this->boundVariables and write it into the variable
$this->boundVariables everything will work the same.
I don't know why by reference was choosen.
In my opinion we should avoid by reference cause it's harder to read and
understand.
Thanks and have a nice day
Sebastian
More information about the TYPO3-project-typo3v4mvc
mailing list