Closed netdown closed 4 years ago
Need this
@albertcht Would you be able to merge some of the pull requests and make a release?
Maybe we should check the class existence for coverage issue.
if (class_exists(FatalThrowableError::class)) {
$e = new FatalThrowableError($e);
} else {
if ($e instanceof \ParseError) {
$severity = E_PARSE;
} elseif ($e instanceof \TypeError) {
$severity = E_RECOVERABLE_ERROR;
} else {
$severity = E_ERROR;
}
$error = [
'type' => $severity,
'message' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
];
$e = new FatalError($e->getMessage(), $e->getCode(), $error, null, true, $e->getTrace());
}
@serdarozturk you say it in order to keep compatibility with older versions?
Why it is not in master?
@albertcht Has this been removed from master and if so, why would that be?
Debug component was deprecated and replaced by ErrorHandler in Symfony 4.4. Laravel 7 uses a Symfony 5 which does not contain Debug anymore, therefore app crashes. ErrorHandler does not have a similar class, therefore I extracted a little bit of logic from the old FatalThrowableError to construct a FatalError object. Fixes #406
EDIT: using getCode() on exception may be a better choice, however, it would behave differently than the old class.