From 992c2189131cc41484bbb087ca0c2ef85ca29d5d Mon Sep 17 00:00:00 2001 From: alexpods Date: Sat, 27 Apr 2013 06:13:33 +0400 Subject: [PATCH] Place hasArgument() check at the beginning of getArgument() method If input definition doesn't have specified argument, then unnecessary operations will be executed ($arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;) --- src/Symfony/Component/Console/Input/InputDefinition.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Console/Input/InputDefinition.php b/src/Symfony/Component/Console/Input/InputDefinition.php index a18da2b2f3..257d057ffc 100644 --- a/src/Symfony/Component/Console/Input/InputDefinition.php +++ b/src/Symfony/Component/Console/Input/InputDefinition.php @@ -153,12 +153,12 @@ class InputDefinition */ public function getArgument($name) { - $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments; - if (!$this->hasArgument($name)) { throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); } + $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments; + return $arguments[$name]; }