diff --git a/classes/ErrorHandler.php b/classes/ErrorHandler.php index a7a7777151..f70d82e0eb 100644 --- a/classes/ErrorHandler.php +++ b/classes/ErrorHandler.php @@ -70,7 +70,7 @@ public function exceptionHandler(Throwable $e): void { $message = get_class($e) . ': ' . $e->getMessage(); $this->report($e->getFile(), $e->getLine(), Logger::CRITICAL, $message, $e->getTraceAsString(), true); - exit(64); + $this->terminate(64); } /** @@ -159,4 +159,12 @@ protected function report(string $file, int $line, int $type, string $message, s fclose($fd); } } + + /** + * @return never + */ + public function terminate(int $code) + { + exit($code); + } } diff --git a/classes/Exceptions/UpgradeException.php b/classes/Exceptions/UpgradeException.php index 25867fa0b9..8dfec5d227 100644 --- a/classes/Exceptions/UpgradeException.php +++ b/classes/Exceptions/UpgradeException.php @@ -55,6 +55,7 @@ public function getQuickInfos(): array $this->quickInfos ); } + return $this->quickInfos; } diff --git a/tests/unit/ErrorHandlerTest.php b/tests/unit/ErrorHandlerTest.php index 14111a7701..f07b80fe12 100644 --- a/tests/unit/ErrorHandlerTest.php +++ b/tests/unit/ErrorHandlerTest.php @@ -37,7 +37,10 @@ protected function setUp() { parent::setUp(); $this->logger = new LegacyLogger(); - $this->errorHandler = new ErrorHandler($this->logger); + $this->errorHandler = $this->getMockBuilder(ErrorHandler::class) + ->setConstructorArgs([$this->logger]) + ->setMethods(['terminate']) + ->getMock(); } public function testDefaultContentIsEmpty()