From a54ea1b6b24c15476211b8648ce1095241cd596e Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Thu, 24 May 2012 05:32:58 +0200 Subject: [PATCH] [OptionsResolver] small optimization in Options class --- src/Symfony/Component/OptionsResolver/Options.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/OptionsResolver/Options.php b/src/Symfony/Component/OptionsResolver/Options.php index 37adef7737..079e0a4050 100644 --- a/src/Symfony/Component/OptionsResolver/Options.php +++ b/src/Symfony/Component/OptionsResolver/Options.php @@ -139,17 +139,15 @@ class Options implements \ArrayAccess, \Iterator, \Countable throw new OptionDefinitionException('Options cannot be overloaded anymore once options have been read.'); } - $newValue = $value; - // Reset lazy flag and locks by default unset($this->lock[$option]); unset($this->lazy[$option]); // If an option is a closure that should be evaluated lazily, store it // inside a LazyOption instance. - if ($this->isEvaluatedLazily($value)) { + if (self::isEvaluatedLazily($value)) { $currentValue = isset($this->options[$option]) ? $this->options[$option] : null; - $newValue = new LazyOption($value, $currentValue); + $value = new LazyOption($value, $currentValue); // Store locks for lazy options to detect cyclic dependencies $this->lock[$option] = false; @@ -158,7 +156,7 @@ class Options implements \ArrayAccess, \Iterator, \Countable $this->lazy[$option] = true; } - $this->options[$option] = $newValue; + $this->options[$option] = $value; } /**