Skip to content

Commit f3c60ef

Browse files
committed
[Console] Simplify using invokable commands when the component is used standalone
1 parent f1813bf commit f3c60ef

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Resources/bin/var-dump-server

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,13 @@ $app->getDefinition()->addOption(
6060
new InputOption('--host', null, InputOption::VALUE_REQUIRED, 'The address the server should listen to', $defaultHost)
6161
);
6262

63-
$app->add($command = new ServerDumpCommand(new DumpServer($host, $logger)))
64-
->getApplication()
63+
$command = new ServerDumpCommand(new DumpServer($host, $logger));
64+
if (method_exists($app, 'addCommand')) {
65+
$app->addCommand($command);
66+
} else {
67+
$app->add($command);
68+
}
69+
$app
6570
->setDefaultCommand($command->getName(), true)
6671
->run($input, $output)
6772
;

0 commit comments

Comments
 (0)