Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. UriInterface.php

function UriInterface::withPort

Return an instance with the specified port.

This method MUST retain the state of the current instance, and return an 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.

Parameters

null|int $port The port to use with the new instance; a null value: removes the port information.

Return value

static A new instance with the specified port.

Throws

\InvalidArgumentException for invalid ports.

1 method overrides UriInterface::withPort()
Uri::withPort in vendor/guzzlehttp/psr7/src/Uri.php
Return an instance with the specified port.

File

vendor/psr/http-message/src/UriInterface.php, line 241

Class

UriInterface
Value object representing a URI.

Namespace

Psr\Http\Message

Code

public function withPort(?int $port) : UriInterface;

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal