function Ip::__construct
Parameters
array<string,mixed>|null $options:
self::V4*|self::V6*|self::ALL*|null $version The IP version to validate (defaults to {@see self::V4}):
string[]|null $groups:
Overrides Constraint::__construct
File
-
vendor/
symfony/ validator/ Constraints/ Ip.php, line 114
Class
- Ip
- Validates that a value is a valid IP address.
Namespace
Symfony\Component\Validator\ConstraintsCode
public function __construct(?array $options = null, ?string $version = null, ?string $message = null, ?callable $normalizer = null, ?array $groups = null, mixed $payload = null) {
parent::__construct($options, $groups, $payload);
$this->version = $version ?? $this->version;
$this->message = $message ?? $this->message;
$this->normalizer = $normalizer ?? $this->normalizer;
if (!\in_array($this->version, static::VERSIONS, true)) {
throw new ConstraintDefinitionException(\sprintf('The option "version" must be one of "%s".', implode('", "', static::VERSIONS)));
}
if (null !== $this->normalizer && !\is_callable($this->normalizer)) {
throw new InvalidArgumentException(\sprintf('The "normalizer" option must be a valid callable ("%s" given).', get_debug_type($this->normalizer)));
}
}