8000 feature #42632 [Console] Deprecate `HelperSet::setCommand()` and `get… · symfony/symfony@2fb15cd · GitHub
[go: up one dir, main page]

Skip to content

Commit 2fb15cd

Browse files
committed
feature #42632 [Console] Deprecate HelperSet::setCommand() and getCommand() (derrabus)
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [Console] Deprecate `HelperSet::setCommand()` and `getCommand()` | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | N/A | License | MIT | Doc PR | N/A The `HelperSet` has a getter and setter for a `Command` property. But as far as I can tell, that property is neither populated nor queried anywhere and I fail to see what purpose that property serves. Because of that I'd like to remove it in Symfony 6. Commits ------- 60bff9b [Console] Deprecate `HelperSet::setCommand()` and `getCommand()`
2 parents 4822448 + 60bff9b commit 2fb15cd

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

UPGRADE-5.4.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ Cache
66

77
* Deprecate `DoctrineProvider` because this class has been added to the `doctrine/cache` package`
88

9+
Console
10+
-------
11+
12+
* Deprecate `HelperSet::setCommand()` and `getCommand()` without replacement
13+
914
Finder
1015
------
1116

UPGRADE-6.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Console
3030
* `Command::setHidden()` has a default value (`true`) for `$hidden` parameter
3131
* Remove `Helper::strlen()`, use `Helper::width()` instead.
3232
* Remove `Helper::strlenWithoutDecoration()`, use `Helper::removeDecoration()` instead.
33+
* Remove `HelperSet::setCommand()` and `getCommand()` without replacement
3334

3435
DependencyInjection
3536
-------------------

src/Symfony/Component/Console/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Add `TesterTrait::assertCommandIsSuccessful()` to test command
8+
* Deprecate `HelperSet::setCommand()` and `getCommand()` without replacement
89

910
5.3
1011
---

src/Symfony/Component/Console/Helper/HelperSet.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,27 @@ public function get(string $name)
7373
return $this->helpers[$name];
7474
}
7575

76+
/**
77+
* @deprecated since Symfony 5.4
78+
*/
7679
public function setCommand(Command $command = null)
7780
{
81+
trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__);
82+
7883
$this->command = $command;
7984
}
8085

8186
/**
8287
* Gets the command associated with this helper set.
8388
*
8489
* @return Command
90+
*
91+
* @deprecated since Symfony 5.4
8592
*/
8693
public function getCommand()
8794
{
95+
trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__);
96+
8897
return $this->command;
8998
}
9099

src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ public function testGet()
7474
}
7575
}
7676

77+
/**
78+
* @group legacy
79+
*/
7780
public function testSetCommand()
7881
{
7982
$cmd_01 = new Command('foo');
@@ -89,6 +92,9 @@ public function testSetCommand()
8992
$this->assertEquals($cmd_02, $helperset->getCommand(), '->setCommand() overwrites stored command with consecutive calls');
9093
}
9194

95+
/**
96+
* @group legacy
97+
*/
9298
public function testGetCommand()
9399
{
94100
$cmd = new Command('foo');

0 commit comments

Comments
 (0)
0