From: Jordi Boggiano Date: Sat, 4 May 2013 20:18:16 +0000 (+0200) Subject: Optimize initGlobals to do only one merge call X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=086088e676756a2e184e92b4b1805eaa8f589c16;p=web%2Fkonrad%2Ftwig.git Optimize initGlobals to do only one merge call --- diff --git a/lib/Twig/Environment.php b/lib/Twig/Environment.php index 54df5be..eafe02a 100644 --- a/lib/Twig/Environment.php +++ b/lib/Twig/Environment.php @@ -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()