diff --git a/UPGRADE-5.4.md b/UPGRADE-5.4.md index 50ff0b1647c57..14b3c9a01a60a 100644 --- a/UPGRADE-5.4.md +++ b/UPGRADE-5.4.md @@ -6,6 +6,11 @@ Cache * Deprecate `DoctrineProvider` because this class has been added to the `doctrine/cache` package` +Console +------- + + * Deprecate `HelperSet::setCommand()` and `getCommand()` without replacement + Finder ------ diff --git a/UPGRADE-6.0.md b/UPGRADE-6.0.md index 44c357d1f5f5b..75566cc34beb6 100644 --- a/UPGRADE-6.0.md +++ b/UPGRADE-6.0.md @@ -30,6 +30,7 @@ Console * `Command::setHidden()` has a default value (`true`) for `$hidden` parameter * Remove `Helper::strlen()`, use `Helper::width()` instead. * Remove `Helper::strlenWithoutDecoration()`, use `Helper::removeDecoration()` instead. + * Remove `HelperSet::setCommand()` and `getCommand()` without replacement DependencyInjection ------------------- diff --git a/src/Symfony/Component/Console/CHANGELOG.md b/src/Symfony/Component/Console/CHANGELOG.md index c8180dcc7911c..fedb08823e15b 100644 --- a/src/Symfony/Component/Console/CHANGELOG.md +++ b/src/Symfony/Component/Console/CHANGELOG.md @@ -5,6 +5,7 @@ CHANGELOG --- * Add `TesterTrait::assertCommandIsSuccessful()` to test command + * Deprecate `HelperSet::setCommand()` and `getCommand()` without replacement 5.3 --- diff --git a/src/Symfony/Component/Console/Helper/HelperSet.php b/src/Symfony/Component/Console/Helper/HelperSet.php index c9d1488f3445b..be806ed9c9927 100644 --- a/src/Symfony/Component/Console/Helper/HelperSet.php +++ b/src/Symfony/Component/Console/Helper/HelperSet.php @@ -73,8 +73,13 @@ public function get(string $name) return $this->helpers[$name]; } + /** + * @deprecated since Symfony 5.4 + */ public function setCommand(Command $command = null) { + trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__); + $this->command = $command; } @@ -82,9 +87,13 @@ public function setCommand(Command $command = null) * Gets the command associated with this helper set. * * @return Command + * + * @deprecated since Symfony 5.4 */ public function getCommand() { + trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__); + return $this->command; } diff --git a/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php b/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php index 38cfc27a194ba..78d22939cd536 100644 --- a/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php @@ -74,6 +74,9 @@ public function testGet() } } + /** + * @group legacy + */ public function testSetCommand() { $cmd_01 = new Command('foo'); @@ -89,6 +92,9 @@ public function testSetCommand() $this->assertEquals($cmd_02, $helperset->getCommand(), '->setCommand() overwrites stored command with consecutive calls'); } + /** + * @group legacy + */ public function testGetCommand() { $cmd = new Command('foo');