8000 [Console] Run `InvokableCommand` via `execute()` method. · symfony/symfony@f4503b6 · GitHub
[go: up one dir, main page]

Skip to content

Commit f4503b6

Browse files
committed
[Console] Run InvokableCommand via execute() method.
1 parent 76ab38f commit f4503b6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Symfony/Component/Console/Command/Command.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,16 @@ protected function configure()
214214
*
215215
* @return int 0 if everything went fine, or an exit code
216216
*
217-
* @throws LogicException When this abstract method is not implemented
217+
* @throws LogicException When this abstract method is not implemented or doesn't implement InvokableCommand
218218
*
219219
* @see setCode()
220220
*/
221221
protected function execute(InputInterface $input, OutputInterface $output): int
222222
{
223+
if ($this->code) {
224+
return ($this->code)($input, $output);
225+
}
226+
223227
throw new LogicException('You must override the execute() method in the concrete command class.');
224228
}
225229

@@ -311,10 +315,6 @@ public function run(InputInterface $input, OutputInterface $output): int
311315

312316
$input->validate();
313317

314-
if ($this->code) {
315-
return ($this->code)($input, $output);
316-
}
317-
318318
return $this->execute($input, $output);
319319
}
320320

0 commit comments

Comments
 (0)
0