Skip to content

Commit 8038b15

Browse files
committed
refactor: run rector
1 parent 7a4d543 commit 8038b15

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

system/Debug/BaseExceptionHandler.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ abstract class BaseExceptionHandler
2828
/**
2929
* ResponseTrait needs this.
3030
*/
31-
protected ?RequestInterface $request;
31+
protected ?RequestInterface $request = null;
3232

3333
/**
3434
* ResponseTrait needs this.
3535
*/
36-
protected ?ResponseInterface $response;
36+
protected ?ResponseInterface $response = null;
3737

3838
/**
3939
* Config for debug exceptions.
@@ -241,9 +241,8 @@ protected function render(Throwable $exception, int $statusCode, $viewFile = nul
241241
// CLI error views output to STDERR/STDOUT, so ob_start() does not work.
242242
ob_start();
243243
include $viewFile;
244-
$output = ob_get_clean();
245244

246-
return $output;
245+
return ob_get_clean();
247246
})();
248247
}
249248
}

system/Debug/Exceptions.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@ public function exceptionHandler(Throwable $exception)
125125

126126
$handler = $this->config->handler($statusCode, $exception);
127127

128-
if (! $handler instanceof BaseExceptionHandler) {
129-
exit('Exception Handler not found.');
130-
}
131-
132128
$handler->handle($exception, $this->request, $this->response, $statusCode, $exitCode);
133129
}
134130

@@ -154,8 +150,6 @@ private function defaultExceptionHandler(Throwable $exception, int $statusCode,
154150
$this->respond(ENVIRONMENT === 'development' ? $this->collectVars($exception, $statusCode) : '', $statusCode)->send();
155151

156152
exit($exitCode);
157-
158-
return; // @phpstan-ignore-line
159153
}
160154
}
161155

tests/system/Debug/ExceptionHandlerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ public function testHandleWebPageNotFoundExceptionDoNotAcceptHTML(): void
9494
$output = ob_get_clean();
9595

9696
$json = json_decode($output);
97-
$this->assertSame('CodeIgniter\Exceptions\PageNotFoundException', $json->title);
98-
$this->assertSame('CodeIgniter\Exceptions\PageNotFoundException', $json->type);
97+
$this->assertSame(PageNotFoundException::class, $json->title);
98+
$this->assertSame(PageNotFoundException::class, $json->type);
9999
$this->assertSame(404, $json->code);
100100
$this->assertSame('Controller or its method is not found: Foo::bar', $json->message);
101101
}

0 commit comments

Comments
 (0)