Skip to content

Commit c58388f

Browse files
committed
Make invokable Commands traceable
1 parent 7f3dd4b commit c58388f

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
@@ -185,6 +185,10 @@ protected function configure()
185185
*/
186186
protected function execute(InputInterface $input, OutputInterface $output): int
187187
{
188+
if ($this->code) {
189+
return $this->code->invoke($input, $output);
190+
}
191+
188192
throw new LogicException('You must override the execute() method in the concrete command class.');
189193
}
190194

@@ -276,11 +280,7 @@ public function run(InputInterface $input, OutputInterface $output): int
276280

277281
$input->validate();
278282

279-
if ($this->code) {
280-
$statusCode = $this->code->invoke($input, $output);
281-
} else {
282-
$statusCode = $this->execute($input, $output);
283-
}
283+
$statusCode = $this->execute($input, $output);
284284

285285
return is_numeric($statusCode) ? (int) $statusCode : 0;
286286
}

0 commit comments

Comments
 (0)