From d9dc1c0feaba4f19822b09df74e1e954b7255b18 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 20 Jul 2023 10:17:35 +0700 Subject: [PATCH] Remove unneeded output property on BaseLoggingCommand --- src/Command/BaseLoggingCommand.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) 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