Skip to content

Commit 7d7d013

Browse files
authored
Optimize events using nullsafe operator (#5473)
1 parent 3bb67fd commit 7d7d013

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/Command.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
419419

420420
$callback = function () {
421421
try {
422-
$this->eventDispatcher && $this->eventDispatcher->dispatch(new Event\BeforeHandle($this));
422+
$this->eventDispatcher?->dispatch(new Event\BeforeHandle($this));
423423
$this->handle();
424-
$this->eventDispatcher && $this->eventDispatcher->dispatch(new Event\AfterHandle($this));
424+
$this->eventDispatcher?->dispatch(new Event\AfterHandle($this));
425425
} catch (Throwable $exception) {
426426
if (class_exists(ExitException::class) && $exception instanceof ExitException) {
427427
return $this->exitCode = (int) $exception->getStatus();
@@ -436,7 +436,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
436436
$this->eventDispatcher->dispatch(new Event\FailToHandle($this, $exception));
437437
return $this->exitCode = (int) $exception->getCode();
438438
} finally {
439-
$this->eventDispatcher && $this->eventDispatcher->dispatch(new Event\AfterExecute($this));
439+
$this->eventDispatcher?->dispatch(new Event\AfterExecute($this));
440440
}
441441

442442
return 0;

0 commit comments

Comments
 (0)