From 086088e676756a2e184e92b4b1805eaa8f589c16 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 4 May 2013 22:18:16 +0200 Subject: [PATCH] Optimize initGlobals to do only one merge call --- lib/Twig/Environment.php | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) 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() -- 1.7.2.5