8000 [Console] InputDefinition: corrected grammar mistakes and added a missing @throws declaration by nanocom · Pull Request #4609 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] InputDefinition: corrected grammar mistakes and added a missing @throws declaration #4609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 19, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/Symfony/Component/Console/Input/InputDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function addArguments($arguments = array())
public function addArgument(InputArgument $argument)
{
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) {
Expand Down Expand Up @@ -262,9 +262,9 @@ public function addOptions($options = array())
public function addOption(InputOption $option)
{
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()]])) {
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;
8000 Expand All @@ -280,6 +280,8 @@ public function addOption(InputOption $option)
*
* @return InputOption A InputOption object
*
* @throws \InvalidArgumentException When option given doesn't exist
*
* @api
*/
public function getOption($name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function testAddArgument()
$this->fail('->addArgument() throws a Exception if another argument is already registered with the same name');
} catch (\Exception $e) {
$this->assertInstanceOf('\Exception', $e, '->addArgument() throws a Exception if another argument is already registered with the same name');
$this->assertEquals('An argument with name "foo" already exist.', $e->getMessage());
$this->assertEquals('An argument with name "foo" already exists.', $e->getMessage());
}

// cannot add a parameter after an array parameter
Expand Down Expand Up @@ -215,14 +215,14 @@ public function testAddOption()
$this->fail('->addOption() throws a Exception if the another option is already registered with the same name');
} catch (\Exception $e) {
$this->assertInstanceOf('\Exception', $e, '->addOption() throws a Exception if the another option is already registered with the same name');
$this->assertEquals('An option named "foo" already exist.', $e->getMessage());
$this->assertEquals('An option named "foo" already exists.', $e->getMessage());
}
try {
$definition->addOption($this->foo1);
$this->fail('->addOption() throws a Exception if the another option is already registered with the same shortcut');
} catch (\Exception $e) {
$this->assertInstanceOf('\Exception', $e, '->addOption() throws a Exception if the another option is already registered with the same shortcut');
$this->assertEquals('An option with shortcut "f" already exist.', $e->getMessage());
$this->assertEquals('An option with shortcut "f" already exists.', $e->getMessage());
}
}

Expand Down
0