src/Message/Uri.php
public function withScheme($scheme)
    {
        $this->validateCharacters($scheme);

        $uri = clone $this;
        $uri->scheme = $scheme;
        return $uri;
    }
public function withScheme($scheme)
    {
        $this->validateCharacters($scheme);

        $uri = clone $this;
        $uri->scheme = $scheme;
        return $uri;
    }
Return an instance with the specified scheme.

@param string $scheme The scheme to use with the new instance.
@return static A new instance with the specified scheme.
@throws \InvalidArgumentException for invalid or unsupported schemes.