src/Url.php
private static function myValidatePort(int $port, ?string &$error): bool
    {
        // Port below 0 is invalid.
        if ($port < 0) {
            $error = 'Port ' . $port . ' is out of range: Minimum port number is 0.';

            return false;
        }

        // Port above 65535 is invalid.
        if ($port > 65535) {
            $error = 'Port ' . $port . ' is out of range: Maximum port number is 65535.';

            return false;
        }

        return true;
    }
private static function myValidatePort(int $port, ?string &$error): bool
    {
        // Port below 0 is invalid.
        if ($port < 0) {
            $error = 'Port ' . $port . ' is out of range: Minimum port number is 0.';

            return false;
        }

        // Port above 65535 is invalid.
        if ($port > 65535) {
            $error = 'Port ' . $port . ' is out of range: Maximum port number is 65535.';

            return false;
        }

        return true;
    }
private static function myValidatePort ( int $ port , ? string & $ error ) : bool { // Port below 0 is invalid. if ( $ port < 0 ) { $ error = 'Port ' . $ port . ' is out of range: Minimum port number is 0.' ; return false ; } // Port above 65535 is invalid. if ( $ port > 65535 ) { $ error = 'Port ' . $ port . ' is out of range: Maximum port number is 65535.' ; return false ; } return true ; }
Validates a port.

@param int    $port  The port.
@param string $error The error text if validation was not successful, undefined otherwise.

@return bool True if validation was successful, false otherwise.
Validates a port .