private static array
$silencedErrorCache =
[];
private static int
$silencedErrorCount = 0;
private static int
$exitCode = 0;
/**
* Registers the error handler.
*/
public static function register(self
$handler = null, bool
$replace = true
): self
{ if (null === self::
$reservedMemory) { self::
$reservedMemory =
str_repeat('x', 32768
);
register_shutdown_function(self::
handleFatalError(...
));
} if ($handlerIsNew = null ===
$handler) { $handler =
new static();
} if (null ===
$prev =
set_error_handler([$handler, 'handleError'
])) { restore_error_handler();
// Specifying the error types earlier would expose us to https://bugs.php.net/63206
set_error_handler([$handler, 'handleError'
],
$handler->thrownErrors |
$handler->loggedErrors
);
$handler->isRoot = true;
}