public static function createFromGlobals(
        array $query = null,
        array $post = null,
        array $cookies = null,
        array $server = null,
        array $files = null,
        array $env = null,
        string $rawBody = null
    ) : Request {
        $query = $query ?? $_GET;
        $post = $post ?? $_POST;
        $cookies = $cookies ?? $_COOKIE;
        $server = $server ?? $_SERVER;
        $files = $files ?? $_FILES;
        $env = $env ?? $_ENV;

        // Handle the a bug that does not set CONTENT_TYPE or CONTENT_LENGTH headers
        if (array_key_exists('HTTP_CONTENT_LENGTH', $server)) {
            $server['CONTENT_LENGTH'] = $server['HTTP_CONTENT_LENGTH'];
        }

        if (array_key_exists('HTTP_CONTENT_TYPE', $server)) {
            $server['CONTENT_TYPE'] = $server['HTTP_CONTENT_TYPE'];
        }

        return new static($query, $post, $cookies, $server, $files, $env, $rawBody);
    }