Skip to content

Commit

Permalink
minor #33790 [Console] remove abbreviation support for hidden command…
Browse files Browse the repository at this point in the history
…s (xabbuh)

This PR was merged into the 5.0-dev branch.

Discussion
----------

[Console] remove abbreviation support for hidden commands

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

6623ec2 remove abbreviation support for hidden commands
  • Loading branch information
chalasr committed Oct 1, 2019
2 parents 5e48c39 + 6623ec2 commit c75098e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Console/Application.php
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
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
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

0 comments on commit c75098e

Please sign in to comment.