final class ErrorHandler
{
// ...
public function handleError(
int $errorLevel,
string $errorMessage,
string $errorFile,
string $errorLine
): void {
if ($errorLevel <= $this->minErrorLevel) {
return;
}
if (E_USER_DEPRECATED === $errorLevel) {
$this->deprecationErrorCollector->record($errorMessage, $errorFile, $errorFile);
}
$this->logger->log(LogLevel::ERROR, $errorMessage, [
'file' => $errorFile,
'line' => $errorLine,
'level' => $errorLevel,
]);
if (in_array($errorLevel, [E_USER_ERROR, E_COMPILE_ERROR, E_CORE_ERROR, E_PARSE], true)) {
$this->emailNotifier->sendErrorAlert('
[email protected]', new Error($errorLevel,
$errorMessage, $errorFile, $errorLine));
}
// ...
}
}