src/Routing/src/UrlGenerator.php
private function addPortToUri(UriInterface $uri): UriInterface
    {
        $requestPort = $this->request->getUri()->getPort();

        if (!in_array($requestPort, [80, 443])) {
            $uri = $uri->withPort($requestPort);
        }

        return $uri;
    }
private function addPortToUri(UriInterface $uri): UriInterface
    {
        $requestPort = $this->request->getUri()->getPort();

        if (!in_array($requestPort, [80, 443])) {
            $uri = $uri->withPort($requestPort);
        }

        return $uri;
    }
private function addPortToUri ( UriInterface $ uri ) : UriInterface { $ requestPort = $ this -> request -> getUri ( ) -> getPort ( ) ; if ( ! in_array ( $ requestPort , [ 80 , 443 ] ) ) { $ uri = $ uri -> withPort ( $ requestPort ) ; } return $ uri ; }
Adds port to URI if it is needed.

@param UriInterface $uri
@return UriInterface
Adds port to URI if it is needed .