diff --git a/src/Command/BaseLoggingCommand.php b/src/Command/BaseLoggingCommand.php index cd19c5bc..324de648 100644 --- a/src/Command/BaseLoggingCommand.php +++ b/src/Command/BaseLoggingCommand.php @@ -26,8 +26,6 @@ abstract class BaseLoggingCommand extends Command private Logging $logging; - private ?OutputInterface $output = null; - /** * MUST BE CALLED after __construct(), as service extends this base class may use depedendency injection * @@ -41,18 +39,19 @@ public function init(array $errorHeroModuleConfig, Logging $logging): void public function run(InputInterface $input, OutputInterface $output): int { - $this->output = $output; - try { $this->phpError(); return parent::run($input, $output); } catch (Throwable $throwable) { } - return $this->exceptionError($throwable); + $this->exceptionError($throwable); + + // show default view if display_errors setting = 0. + return $this->showDefaultConsoleView($output); } - private function exceptionError(Throwable $throwable): int + private function exceptionError(Throwable $throwable): void { if ( isset($this->errorHeroModuleConfig[self::DISPLAY_SETTINGS]['exclude-exceptions']) @@ -69,10 +68,6 @@ private function exceptionError(Throwable $throwable): int if ($this->errorHeroModuleConfig[self::DISPLAY_SETTINGS]['display_errors']) { throw $throwable; } - - // show default view if display_errors setting = 0. - Assert::isInstanceOf($this->output, OutputInterface::class); - return $this->showDefaultConsoleView($this->output); } private function showDefaultConsoleView(OutputInterface $output): int