InputDefinition: corrected grammar mistakes and added a @throws declaration

This commit is contained in:
Arnaud Kleinpeter 2012-06-17 19:22:36 +02:00
parent 086ff48228
commit c0997634ef

View File

@ -113,7 +113,7 @@ class InputDefinition
public function addArgument(InputArgument $argument) public function addArgument(InputArgument $argument)
{ {
if (isset($this->arguments[$argument->getName()])) { if (isset($this->arguments[$argument->getName()])) {
throw new \LogicException(sprintf('An argument with name "%s" already exist.', $argument->getName())); throw new \LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
} }
if ($this->hasAnArrayArgument) { if ($this->hasAnArrayArgument) {
@ -262,9 +262,9 @@ class InputDefinition
public function addOption(InputOption $option) public function addOption(InputOption $option)
{ {
if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) { if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
throw new \LogicException(sprintf('An option named "%s" already exist.', $option->getName())); throw new \LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
} elseif (isset($this->shortcuts[$option->getShortcut()]) && !$option->equals($this->options[$this->shortcuts[$option->getShortcut()]])) { } elseif (isset($this->shortcuts[$option->getShortcut()]) && !$option->equals($this->options[$this->shortcuts[$option->getShortcut()]])) {
throw new \LogicException(sprintf('An option with shortcut "%s" already exist.', $option->getShortcut())); throw new \LogicException(sprintf('An option with shortcut "%s" already exists.', $option->getShortcut()));
} }
$this->options[$option->getName()] = $option; $this->options[$option->getName()] = $option;
@ -280,6 +280,8 @@ class InputDefinition
* *
* @return InputOption A InputOption object * @return InputOption A InputOption object
* *
* @throws \InvalidArgumentException When option given doesn't exist
*
* @api * @api
*/ */
public function getOption($name) public function getOption($name)