private function isAddressValid(string $address): bool
    {
        $position = \strrpos($address, ':');
        if ($position === false) {
            return ($address[0] ?? '') === "\0"; // udg socket address.
        }

        $ip = \trim(\substr($address, 0, $position), '[]');
        $port = (int) \substr($address, $position + 1);

        return \inet_pton($ip) !== false && $port > 0 && $port < 65536;
    }
private function isAddressValid(string $address): bool
    {
        $position = \strrpos($address, ':');
        if ($position === false) {
            return ($address[0] ?? '') === "\0"; // udg socket address.
        }

        $ip = \trim(\substr($address, 0, $position), '[]');
        $port = (int) \substr($address, $position + 1);

        return \inet_pton($ip) !== false && $port > 0 && $port < 65536;
    }
private function isAddressValid ( string $ address ) : bool { $ position = \ strrpos ( $ address , ':' ) ; if ( $ position === false ) { return ( $ address [ 0 ] ?? '' ) === "\0" ; // udg socket address. } $ ip = \ trim ( \ substr ( $ address , 0 , $ position ) , '[]' ) ; $ port = ( int ) \ substr ( $ address , $ position + 1 ) ; return \ inet_pton ( $ ip ) !== false && $ port > 0 && $ port < 65536 ; }
Rough address validation to catch programming mistakes.

@param string $address

@return bool
Rough address validation to catch programming mistakes .