Skip to content

Commit 2f24bc4

Browse files
committed
handle symfony/console compatibility for add/addCommand methods
Signed-off-by: bota <Bota@dotkernel.com>
1 parent 8ad1646 commit 2f24bc4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/Swoole/Delegators/TCPServerDelegator.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use function array_shift;
2424
use function explode;
2525
use function ltrim;
26+
use function method_exists;
2627
use function str_starts_with;
2728
use function trim;
2829

@@ -63,7 +64,11 @@ public function __invoke(ContainerInterface $container, string $serviceName, cal
6364
$commandClass = $commandMap[$commandName];
6465
$application = new Application();
6566
$commandInstance = $container->get($commandClass);
66-
$application->addCommand($commandInstance);
67+
if (method_exists($application, 'addCommand')) {
68+
$application->addCommand($commandInstance);
69+
} else {
70+
$application->add($commandInstance);
71+
}
6772

6873
$parsedOptions = [];
6974
foreach ($args as $arg) {

0 commit comments

Comments
 (0)