protected function registerExceptionHandler(): void
    {
        if (\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
            \ini_set('display_errors', '0');
        } elseif (! \filter_var(\ini_get('log_errors'), \FILTER_VALIDATE_BOOLEAN) || \filter_var(\ini_get('error_log'), \FILTER_VALIDATE_BOOLEAN)) {
            // CLI - display errors only if they're not already logged to STDERR
            \ini_set('display_errors', '1');
        }

        \set_exception_handler([$this, 'handleException']);
    }