return;
} if (!\
is_scalar($value) && !
$value instanceof \Stringable
) { throw new UnexpectedValueException($value, 'string'
);
} $value =
(string) $value;
if ('' ===
$value) { return;
} if (!
$this->
isValid($value) || ($constraint->requireTld && !
$this->
hasValidTld($value))) { $this->context->
buildViolation($constraint->message
) ->
setParameter('{{ value }}',
$this->
formatValue($value)) ->
setCode(Hostname::INVALID_HOSTNAME_ERROR
) ->
addViolation();
} } private function isValid(string
$domain): bool
{ return false !==
filter_var($domain, \FILTER_VALIDATE_DOMAIN, \FILTER_FLAG_HOSTNAME
);
}