lib/Uri.php
public function withPort($port)
    {
        $url = clone $this;
        $url->port = $port;
        $url->hash = null;

        return $url;
    }
public function withPort($port)
    {
        $url = clone $this;
        $url->port = $port;
        $url->hash = null;

        return $url;
    }
public function withPort ( $ port ) { $ url = clone $ this ; $ url -> port = $ port ; $ url -> hash = null ; return $ url ; }
Create a new instance with the specified port.

This method MUST retain the state of the current instance, and return
a new instance that contains the specified port.

Implementations MUST raise an exception for ports outside the
established TCP and UDP port ranges.

A null value provided for the port is equivalent to removing the port
information.

@param null|int $port Port to use with the new instance; a null value
removes the port information.
@return self A new instance with the specified port.
@throws \InvalidArgumentException for invalid ports.
Create a new instance with the specified port .