From 6623ec2131628612a5c41ed4ead2d8c864f30fa6 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 30 Sep 2019 16:19:32 +0200 Subject: [PATCH] remove abbreviation support for hidden commands --- src/Symfony/Component/Console/Application.php | 2 +- src/Symfony/Component/Console/CHANGELOG.md | 1 + .../Console/Tests/ApplicationTest.php | 24 ------------------- 3 files changed, 2 insertions(+), 25 deletions(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 75234ee110cc..9dcafb3d2156 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -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; diff --git a/src/Symfony/Component/Console/CHANGELOG.md b/src/Symfony/Component/Console/CHANGELOG.md index 27342307d988..669f46a8b7fd 100644 --- a/src/Symfony/Component/Console/CHANGELOG.md +++ b/src/Symfony/Component/Console/CHANGELOG.md @@ -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()` diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index e750975d2d46..2b3dd5385435 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -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();