Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2fb15cd

Browse filesBrowse 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
Copy full SHA for 2fb15cd

File tree

5 files changed

+22
-0
lines changed
Filter options

5 files changed

+22
-0
lines changed

‎UPGRADE-5.4.md

Copy file name to clipboardExpand all lines: UPGRADE-5.4.md
+5Lines 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

Copy file name to clipboardExpand all lines: UPGRADE-6.0.md
+1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/CHANGELOG.md
+1Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Helper/HelperSet.php
+9Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php
+6Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.