8000 Merge branch '7.4' into 8.0 · symfony/runtime@f22487c · GitHub
[go: up one dir, main page]

Skip to content

Commit f22487c

Browse files
committed
Merge branch '7.4' into 8.0
* 7.4: [Console] Support enum in invokable commands fix missing newline [Console] Simplify using invokable commands when the component is used standalone [Console] Fix setting aliases & hidden via name remove no longer needed conflict rule on symfony/event-dispatcher [JsonStreamer] Add PHPDoc to generated code [SecurityBundle] register alias for argument for password hasher
2 parents 77c7547 + 3c7162e commit f22487c

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

SymfonyRuntime.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,11 @@ public function getRunner(?object $application): RunnerInterface
162162

163163
if (!$application->getName() || !$console->has($application->getName())) {
164164
$application->setName($_SERVER['argv'][0]);
165-
$console->add($application);
165+
if (method_exists($console, 'addCommand')) {
166+
$console->addCommand($application);
167+
} else {
168+
$console->add($application);
169+
}
166170
}
167171

168172
$console->setDefaultCommand($application->getName(), true);

Tests/phpt/application.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@
2525
});
2626

2727
$app = new Application();
28-
$app->add($command);
28+
if (method_exists($app, 'addCommand')) {
29+
$app->addCommand($command);
30+
} else {
31+
$app->add($command);
32+
}
2933
$app->setDefaultCommand('go', true);
3034

3135
return $app;

Tests/phpt/command_list.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323
$command->setName('my_command');
2424

2525
[$cmd, $args] = $runtime->getResolver(require __DIR__.'/command.php')->resolve();
26-
$app->add($cmd(...$args));
26+
if (method_exists($app, 'addCommand')) {
27+
$app->addCommand($cmd(...$args));
28+
} else {
29+
$app->add($cmd(...$args));
30+
}
2731

2832
return $app;
2933
};

0 commit comments

Comments
 (0)
0