function Locale::__construct
Parameters
array<string,mixed>|null $options:
bool|null $canonicalize Whether to canonicalize the value before validation (defaults to true) (see {@see https://www.php.net/manual/en/locale.canonicalize.php}):
string[]|null $groups:
Overrides Constraint::__construct
File
-
vendor/
symfony/ validator/ Constraints/ Locale.php, line 42
Class
- Locale
- Validates that a value is a valid locale (e.g. fr, fr_FR, etc.).
Namespace
Symfony\Component\Validator\ConstraintsCode
public function __construct(?array $options = null, ?string $message = null, ?bool $canonicalize = null, ?array $groups = null, mixed $payload = null) {
if (!class_exists(Locales::class)) {
throw new LogicException('The Intl component is required to use the Locale constraint. Try running "composer require symfony/intl".');
}
parent::__construct($options, $groups, $payload);
$this->message = $message ?? $this->message;
$this->canonicalize = $canonicalize ?? $this->canonicalize;
}