diff --git a/SymfonyRuntime.php b/SymfonyRuntime.php index 4667bbd..7eff3f5 100644 --- a/SymfonyRuntime.php +++ b/SymfonyRuntime.php @@ -162,10 +162,11 @@ public function getRunner(?object $application): RunnerInterface if (!$application->getName() || !$console->has($application->getName())) { $application->setName($_SERVER['argv'][0]); - if (method_exists($console, 'addCommand')) { - $console->addCommand($application); - } else { + + if (!method_exists($console, 'addCommand') || (new \ReflectionMethod($console, 'add'))->getDeclaringClass()->getName() !== (new \ReflectionMethod($console, 'addCommand'))->getDeclaringClass()->getName()) { $console->add($application); + } else { + $console->addCommand($application); } } diff --git a/composer.json b/composer.json index fa9c2cb..624f905 100644 --- a/composer.json +++ b/composer.json @@ -21,10 +21,10 @@ }, "require-dev": { "composer/composer": "^2.6", - "symfony/console": "^6.4|^7.0", - "symfony/dotenv": "^6.4|^7.0", - "symfony/http-foundation": "^6.4|^7.0", - "symfony/http-kernel": "^6.4|^7.0" + "symfony/console": "^6.4|^7.0|^8.0", + "symfony/dotenv": "^6.4|^7.0|^8.0", + "symfony/http-foundation": "^6.4|^7.0|^8.0", + "symfony/http-kernel": "^6.4|^7.0|^8.0" }, "conflict": { "symfony/dotenv": "<6.4"