From 5cdaf36649d811b02c5882e568a2b50a767e34b0 Mon Sep 17 00:00:00 2001 From: W0rma Date: Fri, 28 Nov 2025 08:12:20 +0100 Subject: [PATCH] chore(deps): add support for symfony 8 --- composer.json | 2 +- src/CompletionCommand.php | 2 +- .../BashCompletion/Common/CompletionHandlerTestCase.php | 7 ++++++- .../Console/BashCompletion/CompletionCommandTest.php | 7 ++++++- .../BashCompletion/Fixtures/CompletionAwareCommand.php | 2 +- .../Console/BashCompletion/Fixtures/HiddenCommand.php | 2 +- .../Console/BashCompletion/Fixtures/TestBasicCommand.php | 2 +- .../BashCompletion/Fixtures/TestSymfonyStyleCommand.php | 2 +- 8 files changed, 18 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 2e9bf73..b0ad3d1 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ ], "require": { "php": ">=8.1", - "symfony/console": "~6.4 || ^7.1" + "symfony/console": "~6.4 || ^7.1 || ^8.0" }, "require-dev": { "phpunit/phpunit": "^9.5", diff --git a/src/CompletionCommand.php b/src/CompletionCommand.php index ef0b3e4..450e6fa 100644 --- a/src/CompletionCommand.php +++ b/src/CompletionCommand.php @@ -15,7 +15,7 @@ class CompletionCommand extends SymfonyCommand */ protected $handler; - protected function configure() + protected function configure(): void { $this ->setName('_completion') diff --git a/tests/Stecman/Component/Symfony/Console/BashCompletion/Common/CompletionHandlerTestCase.php b/tests/Stecman/Component/Symfony/Console/BashCompletion/Common/CompletionHandlerTestCase.php index 8aa5152..f5a00ec 100644 --- a/tests/Stecman/Component/Symfony/Console/BashCompletion/Common/CompletionHandlerTestCase.php +++ b/tests/Stecman/Component/Symfony/Console/BashCompletion/Common/CompletionHandlerTestCase.php @@ -39,7 +39,12 @@ protected function setUp(): void )); if (method_exists('\HiddenCommand', 'setHidden')) { - $this->application->add(new \HiddenCommand()); + // Added in symfony 7.4 + if (method_exists($this->application, 'addCommand')) { + $this->application->addCommand(new \HiddenCommand()); + } else { + $this->application->add(new \HiddenCommand()); + } } } diff --git a/tests/Stecman/Component/Symfony/Console/BashCompletion/CompletionCommandTest.php b/tests/Stecman/Component/Symfony/Console/BashCompletion/CompletionCommandTest.php index a190aad..1937c9e 100644 --- a/tests/Stecman/Component/Symfony/Console/BashCompletion/CompletionCommandTest.php +++ b/tests/Stecman/Component/Symfony/Console/BashCompletion/CompletionCommandTest.php @@ -30,7 +30,12 @@ public function testConflictingGlobalOptions() new InputOption('program', null, InputOption::VALUE_REQUIRED) ); - $app->add(new CompletionCommand()); + // Added in symfony 7.4 + if (method_exists($app, 'addCommand')) { + $app->addCommand(new CompletionCommand()); + } else { + $app->add(new CompletionCommand()); + } // Check completion command doesn't throw $app->doRun(new StringInput('_completion -g --program foo'), new NullOutput()); diff --git a/tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/CompletionAwareCommand.php b/tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/CompletionAwareCommand.php index 119a5ac..372366c 100644 --- a/tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/CompletionAwareCommand.php +++ b/tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/CompletionAwareCommand.php @@ -9,7 +9,7 @@ class CompletionAwareCommand extends Command implements CompletionAwareInterface { - protected function configure() + protected function configure(): void { $this->setName('completion-aware') ->addOption('option-with-suggestions', null, InputOption::VALUE_REQUIRED) diff --git a/tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/HiddenCommand.php b/tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/HiddenCommand.php index acf8b6a..ba137df 100644 --- a/tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/HiddenCommand.php +++ b/tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/HiddenCommand.php @@ -4,7 +4,7 @@ class HiddenCommand extends Command { - protected function configure() + protected function configure(): void { $this->setName('internals') ->setHidden(true); diff --git a/tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/TestBasicCommand.php b/tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/TestBasicCommand.php index f16b403..a69a4a9 100644 --- a/tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/TestBasicCommand.php +++ b/tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/TestBasicCommand.php @@ -6,7 +6,7 @@ class TestBasicCommand extends Command { - protected function configure() + protected function configure(): void { $this->setName('wave') ->addOption( diff --git a/tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/TestSymfonyStyleCommand.php b/tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/TestSymfonyStyleCommand.php index 80026f1..6baf91b 100644 --- a/tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/TestSymfonyStyleCommand.php +++ b/tests/Stecman/Component/Symfony/Console/BashCompletion/Fixtures/TestSymfonyStyleCommand.php @@ -5,7 +5,7 @@ class TestSymfonyStyleCommand extends Command { - protected function configure() + protected function configure(): void { $this->setName('walk:north') ->addOption(