'TIMEZONE_IDENTIFIER_ERROR', self::TIMEZONE_IDENTIFIER_IN_ZONE_ERROR => 'TIMEZONE_IDENTIFIER_IN_ZONE_ERROR', self::TIMEZONE_IDENTIFIER_IN_COUNTRY_ERROR => 'TIMEZONE_IDENTIFIER_IN_COUNTRY_ERROR', self::TIMEZONE_IDENTIFIER_INTL_ERROR => 'TIMEZONE_IDENTIFIER_INTL_ERROR']; public function __construct($zone = null, ?string $message = null, ?string $countryCode = null, ?bool $intlCompatible = null, ?array $groups = null, $payload = null, array $options = []) { if (\is_array($zone)) { $options = \array_merge($zone, $options); } elseif (null !== $zone) { $options['value'] = $zone; } parent::__construct($options, $groups, $payload); $this->message = $message ?? $this->message; $this->countryCode = $countryCode ?? $this->countryCode; $this->intlCompatible = $intlCompatible ?? $this->intlCompatible; if (null === $this->countryCode) { if (0 >= $this->zone || \DateTimeZone::ALL_WITH_BC < $this->zone) { throw new ConstraintDefinitionException('The option "zone" must be a valid range of "\\DateTimeZone" constants.'); } } elseif (\DateTimeZone::PER_COUNTRY !== (\DateTimeZone::PER_COUNTRY & $this->zone)) { throw new ConstraintDefinitionException('The option "countryCode" can only be used when the "zone" option is configured with "\\DateTimeZone::PER_COUNTRY".'); } if ($this->intlCompatible && !\class_exists(\IntlTimeZone::class)) { throw new ConstraintDefinitionException('The option "intlCompatible" can only be used when the PHP intl extension is available.'); } } public function getDefaultOption() { return 'zone'; } }