src/Valkyrja/HttpMessage/NativeUri.php
public function withHost(string $host): Uri
    {
        if ($host === $this->host) {
            return clone $this;
        }

        $new = clone $this;

        $new->host = $host;

        return $new;
    }
public function withHost(string $host): Uri
    {
        if ($host === $this->host) {
            return clone $this;
        }

        $new = clone $this;

        $new->host = $host;

        return $new;
    }
Return an instance with the specified host.

This method MUST retain the state of the current instance, and return
an instance that contains the specified host.

An empty host value is equivalent to removing the host.

@param string $host The hostname to use with the new instance.

@throws \InvalidArgumentException for invalid hostnames.

@return static A new instance with the specified host.