8000 [console][ArrayInput] avoid return array value for getFirstArgument. by aitboudad · Pull Request #14197 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[console][ArrayInput] avoid return array value for getFirstArgument. #14197

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

Closed
wants to merge 1 commit into from
Closed
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
[console][ArrayInput] avoid return array value 8000 for getFirstArgument.
  • Loading branch information
aitboudad committed Apr 3, 2015
commit 4b006a2f0e4a631b975c0025d7b9da0d6cbc99fa
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Input/ArrayInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct(array $parameters, InputDefinition $definition = nul
public function getFirstArgument()
{
foreach ($this->parameters as $key => $value) {
if ($key && '-' === $key[0]) {
if (($key && '-' === $key[0]) || !is_string($value)) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function testGetFirstArgument()
$this->assertNull($input->getFirstArgument(), '->getFirstArgument() returns null if no argument were passed');
$input = new ArrayInput(array('name' => 'Fabien'));
$this->assertEquals('Fabien', $input->getFirstArgument(), '->getFirstArgument() returns the first passed argument');
$input = new ArrayInput(array('--foo' => 'bar', 'name' => 'Fabien'));
$input = new ArrayInput(array('--foo' => 'bar', 'names' => array('Fabien'), 'name' => 'Fabien'));
$this->assertEquals('Fabien', $input->getFirstArgument(), '->getFirstArgument() returns the first passed argument');
}

Expand Down
0