src/Viserio/Component/Http/Request.php
private function createUri($uri): UriInterface
    {
        if ($uri instanceof UriInterface) {
            return $uri;
        }

        if (\is_string($uri)) {
            return Uri::createFromString($uri);
        }

        if ($uri === null) {
            return Uri::createFromString();
        }

        throw new InvalidArgumentException(
            'Invalid URI provided; must be null, a string or a [\Psr\Http\Message\UriInterface] instance.'
        );
    }
private function createUri($uri): UriInterface
    {
        if ($uri instanceof UriInterface) {
            return $uri;
        }

        if (\is_string($uri)) {
            return Uri::createFromString($uri);
        }

        if ($uri === null) {
            return Uri::createFromString();
        }

        throw new InvalidArgumentException(
            'Invalid URI provided; must be null, a string or a [\Psr\Http\Message\UriInterface] instance.'
        );
    }
Create and return a URI instance.

If `$uri` is a already a `UriInterface` instance, returns it.

If `$uri` is a string, passes it to the `Uri` constructor to return an
instance.

If `$uri is null, creates and returns an empty `Uri` instance.

Otherwise, it raises an exception.

@param null|string|UriInterface $uri

@throws \Viserio\Component\Contract\Http\Exception\InvalidArgumentException

@return \Psr\Http\Message\UriInterface