Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Console] remove abbreviation support for hidden commands #33790

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 1 commit into from
Oct 1, 2019
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
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ public function find(string $name)
$command = $this->get(reset($commands));

if ($command->isHidden()) {
@trigger_error(sprintf('Command "%s" is hidden, finding it using an abbreviation is deprecated since Symfony 4.4, use its full name instead.', $command->getName()), E_USER_DEPRECATED);
throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
}

return $command;
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Console/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
5.0.0
-----

* removed support for finding hidden commands using an abbreviation, use the full name instead
* removed `TableStyle::setCrossingChar()` method in favor of `TableStyle::setDefaultCrossingChar()`
* removed `TableStyle::setHorizontalBorderChar()` method in favor of `TableStyle::setDefaultCrossingChars()`
* removed `TableStyle::getHorizontalBorderChar()` method in favor of `TableStyle::getBorderChars()`
Expand Down
24 changes: 0 additions & 24 deletions src/Symfony/Component/Console/Tests/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -728,30 +728,6 @@ public function testFindHiddenWithExactName()
$this->assertInstanceOf('FooHiddenCommand', $application->find('afoohidden'));
}

/**
* @group legacy
* @expectedDeprecation Command "%s:hidden" is hidden, finding it using an abbreviation is deprecated since Symfony 4.4, use its full name instead.
* @dataProvider provideAbbreviationsForHiddenCommands
*/
public function testFindHiddenWithAbbreviatedName($name)
{
$application = new Application();

$application->add(new \FooHiddenCommand());
$application->add(new \BarHiddenCommand());

$application->find($name);
}

public function provideAbbreviationsForHiddenCommands()
{
return [
['foo:hidde'],
['afoohidd'],
['bar:hidde'],
];
}

public function testFindAmbiguousCommandsIfAllAlternativesAreHidden()
{
$application = new Application();
Expand Down