src/Url.php
public function withPort(int $port): UrlInterface
    {
        if (!self::myValidatePort($port, $error)) {
            throw new UrlInvalidArgumentException($error);
        }

        return new self($this->myScheme, $this->myHost, $port, $this->myPath, $this->myQueryString, $this->myFragment);
    }
public function withPort(int $port): UrlInterface
    {
        if (!self::myValidatePort($port, $error)) {
            throw new UrlInvalidArgumentException($error);
        }

        return new self($this->myScheme, $this->myHost, $port, $this->myPath, $this->myQueryString, $this->myFragment);
    }
public function withPort ( int $ port ) : UrlInterface { if ( ! self :: myValidatePort ( $ port , $ error ) ) { throw new UrlInvalidArgumentException ( $ error ) ; } return new self ( $ this -> myScheme , $ this -> myHost , $ port , $ this -> myPath , $ this -> myQueryString , $ this -> myFragment ) ; }
Returns a copy of the Url instance with the specified port.

@since 1.0.0

@param int $port The port.

@throws UrlInvalidArgumentException If the port is out of range.

@return UrlInterface The Url instance.
Returns a copy of the Url instance with the specified port .