remove abbreviation support for hidden commands

This commit is contained in:
Christian Flothmann 2019-09-30 16:19:32 +02:00
parent 81ae635100
commit 6623ec2131
3 changed files with 2 additions and 25 deletions

View File

@ -693,7 +693,7 @@ class Application implements ResetInterface
$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;

View File

@ -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()`

View File

@ -728,30 +728,6 @@ class ApplicationTest extends TestCase
$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();