8000 feature #42634 [Console] Remove `HelperSet::setCommand()` and `getCom… · symfony/symfony@18a00fd · GitHub
[go: up one dir, main page]

Skip to content

Commit 18a00fd

Browse files
committed
feature #42634 [Console] Remove HelperSet::setCommand() and getCommand() (derrabus)
This PR was merged into the 6.0 branch. Discussion ---------- [Console] Remove `HelperSet::setCommand()` and `getCommand()` | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A Follows #42632. Commits ------- 6a1c407 Remove HelperSet::setCommand() and getCommand()
2 parents 06755c6 + 6a1c407 commit 18a00fd

File tree

3 files changed

+1
-54
lines changed

3 files changed

+1
-54
lines changed

src/Symfony/Component/Console/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ CHANGELOG
88
* Remove `Helper::strlen()`, use `Helper::width()` instead
99
* Remove `Helper::strlenWithoutDecoration()`, use `Helper::removeDecoration()` instead
1010
* `AddConsoleCommandPass` can not be configured anymore
11+
* Remove `HelperSet::setCommand()` and `getCommand()` without replacement
1112

1213
5.4
1314
---

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

-24
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Console\Helper;
1313

14-
use Symfony\Component\Console\Command\Command;
1514
use Symfony\Component\Console\Exception\InvalidArgumentException;
1615

1716
/**
@@ -25,7 +24,6 @@ class HelperSet implements \IteratorAggregate
2524
* @var Helper[]
2625
*/
2726
private $helpers = [];
28-
private $command;
2927

3028
/**
3129
* @param Helper[] $helpers An array of helper
@@ -69,28 +67,6 @@ public function get(string $name): HelperInterface
6967
return $this->helpers[$name];
7068
}
7169

72-
/**
73-
* @deprecated since Symfony 5.4
74-
*/
75-
public function setCommand(Command $command = null)
76-
{
77-
trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__);
78-
79-
$this->command = $command;
80-
}
81-
82-
/**
83-
* Gets the command associated with this helper set.
84-
*
85-
* @deprecated since Symfony 5.4
86-
*/
87-
public function getCommand(): Command
88-
{
89-
trigger_deprecation('symfony/console', '5.4', 'Method "%s()" is deprecated.', __METHOD__);
90-
91-
return $this->command;
92-
}
93-
9470
/**
9571
* @return \Traversable<string, Helper>
9672
*/

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

-30
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Console\Tests\Helper;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Component\Console\Command\Command;
1615
use Symfony\Component\Console\Exception\ExceptionInterface;
1716
use Symfony\Component\Console\Helper\HelperInterface;
1817
use Symfony\Component\Console\Helper\HelperSet;
@@ -74,35 +73,6 @@ public function testGet()
7473
}
7574
}
7675

77-
/**
78-
* @group legacy
79-
*/
80-
public function testSetCommand()
81-
{
82-
$cmd_01 = new Command('foo');
83-
$cmd_02 = new Command('bar');
84-
85-
$helperset = new HelperSet();
86-
$helperset->setCommand($cmd_01);
87-
$this->assertEquals($cmd_01, $helperset->getCommand(), '->setCommand() stores given command');
88-
89-
$helperset = new HelperSet();
90-
$helperset->setCommand($cmd_01);
91-
$helperset->setCommand($cmd_02);
92-
$this->assertEquals($cmd_02, $helperset->getCommand(), '->setCommand() overwrites stored command with consecutive calls');
93-
}
94-
95-
/**
96-
* @group legacy
97-
*/
98-
public function testGetCommand()
99-
{
100-
$cmd = new Command('foo');
101-
$helperset = new HelperSet();
102-
$helperset->setCommand($cmd);
103-
$this->assertEquals($cmd, $helperset->getCommand(), '->getCommand() retrieves stored command');
104-
}
105-
10676
public function testIteration()
10777
{
10878
$helperset = new HelperSet();

0 commit comments

Comments
 (0)
0