src/Valkyrja/HttpMessage/ServerRequestFactory.php
public static function fromGlobals(
        array $server = null,
        array $query = null,
        array $body = null,
        array $cookies = null,
        array $files = null
    ): ServerRequest {
        $server  = static::normalizeServer($server ?: $_SERVER);
        $files   = static::normalizeFiles($files ?: $_FILES);
        $headers = static::marshalHeaders($server);

        if (null === $cookies && array_key_exists('cookie', $headers)) {
            $cookies = self::parseCookieHeader($headers['cookie']);
        }

        return new NativeServerRequest(
            static::marshalUriFromServer($server, $headers),
            static::get('REQUEST_METHOD', $server, RequestMethod::GET),
            new NativeStream('php://input'),
            $headers,
            $server,
            $cookies ?? $_COOKIE,
            $query ?? $_GET,
            $body ?? $_POST,
            $files,
            static::marshalProtocolVersion($server)
        );
    }
public static function fromGlobals(
        array $server = null,
        array $query = null,
        array $body = null,
        array $cookies = null,
        array $files = null
    ): ServerRequest {
        $server  = static::normalizeServer($server ?: $_SERVER);
        $files   = static::normalizeFiles($files ?: $_FILES);
        $headers = static::marshalHeaders($server);

        if (null === $cookies && array_key_exists('cookie', $headers)) {
            $cookies = self::parseCookieHeader($headers['cookie']);
        }

        return new NativeServerRequest(
            static::marshalUriFromServer($server, $headers),
            static::get('REQUEST_METHOD', $server, RequestMethod::GET),
            new NativeStream('php://input'),
            $headers,
            $server,
            $cookies ?? $_COOKIE,
            $query ?? $_GET,
            $body ?? $_POST,
            $files,
            static::marshalProtocolVersion($server)
        );
    }
Create a request from the supplied superglobal values.

If any argument is not supplied, the corresponding superglobal value will
be used.

The ServerRequest created is then passed to the fromServer() method in
order to marshal the request URI and headers.

@see fromServer()

@param array $server  $_SERVER superglobal
@param array $query   $_GET superglobal
@param array $body    $_POST superglobal
@param array $cookies $_COOKIE superglobal
@param array $files   $_FILES superglobal

@throws \InvalidArgumentException
@throws \UnexpectedValueException
@throws \Valkyrja\HttpMessage\Exceptions\InvalidUploadedFile
@throws \Valkyrja\HttpMessage\Exceptions\InvalidStream
@throws \Valkyrja\HttpMessage\Exceptions\InvalidScheme
@throws \Valkyrja\HttpMessage\Exceptions\InvalidQuery
@throws \Valkyrja\HttpMessage\Exceptions\InvalidProtocolVersion
@throws \Valkyrja\HttpMessage\Exceptions\InvalidPort
@throws \Valkyrja\HttpMessage\Exceptions\InvalidPath
@throws \Valkyrja\HttpMessage\Exceptions\InvalidMethod

@return ServerRequest