merged branch alexpods/patch-1 (PR #7864)
This PR was merged into the master branch.
Discussion
----------
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;)
Commits
-------
992c218
Place hasArgument() check at the beginning of getArgument() method
This commit is contained in:
commit
2dfcc8d8aa
@ -153,12 +153,12 @@ class InputDefinition
|
|||||||
*/
|
*/
|
||||||
public function getArgument($name)
|
public function getArgument($name)
|
||||||
{
|
{
|
||||||
$arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
|
|
||||||
|
|
||||||
if (!$this->hasArgument($name)) {
|
if (!$this->hasArgument($name)) {
|
||||||
throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $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];
|
return $arguments[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user