*/
class ErrorHandler
{
/** @var ?IOInterface */
private static $io;
/**
* Error handler
*
* @param int $level Level of the error raised
* @param string $message Error message
* @param string $file Filename that the error was raised in
* @param int $line Line number the error was raised at
*
* @static
* @throws \ErrorException
*/
public static function handle(int $level, string $message, string $file, int $line): bool
{
$isDeprecationNotice = $level === E_DEPRECATED || $level === E_USER_DEPRECATED;
// error code is not included in error_reporting
if (!$isDeprecationNotice && 0 === (error_reporting() & $level)) {
return true;
}
if (filter_var(ini_get('xdebug.scream'), FILTER_VALIDATE_BOOLEAN)) {
$message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
"\na legitimately suppressed error that you were not supposed to see.";
}
if (!$isDeprecationNotice) {
throw new \ErrorException($message, 0, $level, $file, $line);
}
if (self::$io !== null) {
self::$io->writeError('Deprecation Notice: '.$message.' in '.$file.':'.$line.'');
if (self::$io->isVerbose()) {
self::$io->writeError('Stack trace:');
self::$io->writeError(array_filter(array_map(static function ($a): ?string {
if (isset($a['line'], $a['file'])) {
return ' '.$a['file'].':'.$a['line'].'';
}
return null;
}, array_slice(debug_backtrace(), 2)), function (?string $line) {
return $line !== null;
}));
}
}
return true;
}
/**
* Register error handler.
*/
public static function register(?IOInterface $io = null): void
{
set_error_handler([__CLASS__, 'handle']);
error_reporting(E_ALL);
self::$io = $io;
}
}__halt_compiler();----SIGNATURE:----HjKg8vPxs7CFkH7RpVd/sB9pAHEJwTl7/ePv5rMvhhPglHbw4o1e2t/OSKtrS+6c88aVf2e4tD5IMlBpWkZghufEj8anNdOYV1P8rqBtZiwBHIBT4INiLtWTVxo/+t3s44qH9R4s8q/aAqdZQmd3eU+GNb8FQbH7uzWtFzgGMYx5dElEbFrdrHfEJHa9KJKcWcyQ+QSpOdczBLSrU+SOfT2hn40goS3K/D/+fppMRYekT9JcT2eVOcpBvF1mwHywePJiVRq9A1hBlCuE3PmcgZ5Agm3P12Ba5H0xNYttwkvbF9yfeCKNABB3UoI2PJGt5eU3gMYOklJu6WEyLsHYEi4NtELtJvHg+Mb5DaHeRnblVv7nBsmckvl9y7h55GiKCWaJHYx2MhTMa76D9xE+AcDFQ4fy8jXOx6obw/bUPPt625BswPoSPNMJGmdP5PiWU1Bhm8qjSqKECEm3CSTOMw6Hfcldl7dvnX7E+AhWR8EIJwXuu2jpDVGuapEzTVuD1nniKFJWWV7880lwRCqrCL9GTyKCJqeQ3ZVQL3tJRdZ3kYY2CQxHZfl6dMHvz4v2vXzEB95cCjzSH/bdMgJyxWIdKGPO39/KnbfAAc6EZFTF0bu45Lu0YRZ36fDYZFsoGhAbqG67VwodSEimXbHd187fWWAS2Gja9tJsAa+1eqI=----ATTACHMENT:----MTcwNDc3MDc0ODYzNTIxNiA2MjA5OTQ2MjcxNDU1NzgzIDU2NjAxMjM0NDQzMDcyNzQ=