Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Dec 5, 2023
1 parent 7094fc1 commit c52cde0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Framework/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public static function setupErrors(): void

set_exception_handler([self::class, 'handleException']);

set_error_handler(function (int $severity, string $message, string $file, int $line): ?bool {
set_error_handler(static function (int $severity, string $message, string $file, int $line): ?bool {
if (
in_array($severity, [E_RECOVERABLE_ERROR, E_USER_ERROR], true)
|| ($severity & error_reporting()) === $severity
Expand All @@ -122,11 +122,11 @@ public static function setupErrors(): void
return false;
});

register_shutdown_function(function (): void {
register_shutdown_function(static function (): void {
Assert::$onFailure = [self::class, 'handleException'];

$error = error_get_last();
register_shutdown_function(function () use ($error): void {
register_shutdown_function(static function () use ($error): void {
if (in_array($error['type'] ?? null, [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE], true)) {
if (($error['type'] & error_reporting()) !== $error['type']) { // show fatal errors hidden by @shutup
self::print("\n" . Dumper::color('white/red', "Fatal error: $error[message] in $error[file] on line $error[line]"));
Expand Down

0 comments on commit c52cde0

Please sign in to comment.