phasync
Uri / withPort

Method

Uri::withPort

Returns a copy of the URI with the port replaced; null removes it.

Description#

public Uri::withPort(
    $port
): UriInterface

Parameters#

$port

Return values#

UriInterface

Errors / Exceptions#

ExceptionWhen
InvalidArgumentExceptionFor a port outside 1-65535, or a port on a URI without a host

See also#

  • Psr\Http\Message\UriInterface::withPort