Skip to content

Commit

Permalink
Remove unneeded output property on BaseLoggingCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jul 20, 2023
1 parent a721c2f commit d9dc1c0
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/Command/BaseLoggingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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'])
Expand All @@ -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
Expand Down

0 comments on commit d9dc1c0

Please sign in to comment.