<?php set_error_handler(?callable $callback, int $error_levels = E_ALL): ?callable
<?php try { \trigger_error($error, E_USER_ERROR); } catch (\Throwable $e) { \set_error_handler(null); \trigger_error($error, E_USER_ERROR); } }
<?php { $errors = []; set_error_handler(function ($errno, $errstr, $errfile, $errline) use (&$errors) { $errors[] = compact('errno', 'errstr', 'errfile', 'errline'); }); $this->errors = &$errors; }