Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Console] Fix issue with reserved keyword "command" as argument name #54795

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

Open
wants to merge 5 commits into
base: 7.4
Choose a base branch
Loading
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix tests, remove void return type in test
  • Loading branch information
flkasper committed May 1, 2024
commit d67fa0ca80e3d73e7feb0ddb5eb0a684433ce1db
2 changes: 1 addition & 1 deletion 2 src/Symfony/Component/Console/Tests/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ public function testAddingAlreadySetDefinitionElementData($def)
public static function getAddingAlreadySetDefinitionElementData(): array
{
return [
[new InputArgument('command', InputArgument::REQUIRED)],
[new InputArgument('command', InputArgument::REQUIRED, 'The command to execute')],
[new InputOption('quiet', '', InputOption::VALUE_NONE)],
[new InputOption('query', 'q', InputOption::VALUE_NONE)],
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public static function provideInvalidInput(): array
],
[
['cli.php', 'acme:foo', 'bar'],
new InputDefinition([new InputArgument('command', InputArgument::REQUIRED)]),
new InputDefinition([new InputArgument('command', InputArgument::REQUIRED, 'The command to execute')]),
'No arguments expected for "acme:foo" command, got "bar"',
],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testConstructor()
$this->assertEquals('foo', $argument->getName(), '__construct() takes a name as its first argument');
}

public function testReservedArgumentName(): void
public function testReservedArgumentName()
{
self::expectException(InvalidArgumentException::class);
self::expectExceptionMessage('Reserved keyword "command" was used as argument name.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\Output;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\Question;
Expand All @@ -30,7 +31,7 @@ class CommandTesterTest extends TestCase
protected function setUp(): void
{
$this->command = new Command('foo');
$this->command->addArgument('command');
$this->command->addArgument('command', InputArgument::REQUIRED, 'The command to execute');
$this->command->addArgument('foo');
$this->command->setCode(function ($input, $output) { $output->writeln('foo'); });

Expand Down Expand Up @@ -231,7 +232,7 @@ public function testSymfonyStyleCommandWithInputs()
public function testErrorOutput()
{
$command = new Command('foo');
$command->addArgument('command');
$command->addArgument('command', InputArgument::REQUIRED, 'The command to execute');
$command->addArgument('foo');
$command->setCode(function ($input, $output) {
$output->getErrorOutput()->write('foo');
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.