Optimize initGlobals to do only one merge call

This commit is contained in:
Jordi Boggiano
2013-05-04 22:18:16 +02:00
parent 7f70bbf775
commit 086088e676
+5 -3
View File
@@ -1103,11 +1103,13 @@ class Twig_Environment
if (!is_array($extGlob)) {
throw new UnexpectedValueException(sprintf('"%s::getGlobals()" must return an array of globals.', get_class($extension)));
}
$globals = array_merge($globals, $extGlob);
$globals[] = $extGlob;
}
return array_merge($globals, $this->staging->getGlobals());
$globals[] = $this->staging->getGlobals();
return call_user_func_array('array_merge', $globals);
}
protected function initExtensions()