Skip to content

Commit f66c1a9

Browse files
authored
Merge pull request #108 from W0rma/symfony8
Add support for symfony 8
2 parents ce1e013 + 5cdaf36 commit f66c1a9

File tree

8 files changed

+18
-8
lines changed

8 files changed

+18
-8
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
],
1111
"require": {
1212
"php": ">=8.1",
13-
"symfony/console": "~6.4 || ^7.1"
13+
"symfony/console": "~6.4 || ^7.1 || ^8.0"
1414
},
1515
"require-dev": {
1616
"phpunit/phpunit": "^9.5",

src/CompletionCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class CompletionCommand extends SymfonyCommand
1515
*/
1616
protected $handler;
1717

18-
protected function configure()
18+
protected function configure(): void
1919
{
2020
$this
2121
->setName('_completion')

tests/Stecman/Component/Symfony/Console/BashCompletion/Common/CompletionHandlerTestCase.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ protected function setUp(): void
3939
));
4040

4141
if (method_exists('\HiddenCommand', 'setHidden')) {
42-
$this->application->add(new \HiddenCommand());
42+
// Added in symfony 7.4
43+
if (method_exists($this->application, 'addCommand')) {
44+
$this->application->addCommand(new \HiddenCommand());
45+
} else {
46+
$this->application->add(new \HiddenCommand());
47+
}
4348
}
4449
}
4550

tests/Stecman/Component/Symfony/Console/BashCompletion/CompletionCommandTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ public function testConflictingGlobalOptions()
3030
new InputOption('program', null, InputOption::VALUE_REQUIRED)
3131
);
3232

33-
$app->add(new CompletionCommand());
33+
// Added in symfony 7.4
34+
if (method_exists($app, 'addCommand')) {
35+
$app->addCommand(new CompletionCommand());
36+
} else {
37+
$app->add(new CompletionCommand());
38+
}
3439

3540
// Check completion command doesn't throw
3641
$app->doRun(new StringInput('_completion -g --program foo'), new NullOutput());

tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/CompletionAwareCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class CompletionAwareCommand extends Command implements CompletionAwareInterface
1111
{
12-
protected function configure()
12+
protected function configure(): void
1313
{
1414
$this->setName('completion-aware')
1515
->addOption('option-with-suggestions', null, InputOption::VALUE_REQUIRED)

tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/HiddenCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class HiddenCommand extends Command
66
{
7-
protected function configure()
7+
protected function configure(): void
88
{
99
$this->setName('internals')
1010
->setHidden(true);

tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/TestBasicCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class TestBasicCommand extends Command
88
{
9-
protected function configure()
9+
protected function configure(): void
1010
{
1111
$this->setName('wave')
1212
->addOption(

tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/TestSymfonyStyleCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
class TestSymfonyStyleCommand extends Command
77
{
8-
protected function configure()
8+
protected function configure(): void
99
{
1010
$this->setName('walk:north')
1111
->addOption(

0 commit comments

Comments
 (0)