Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Country.php

function Country::__construct

Parameters

array<string,mixed>|null $options:

bool|null $alpha3 Whether to check for alpha-3 codes instead of alpha-2 (defaults to false):

string[]|null $groups:

Overrides Constraint::__construct

See also

https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Current_codes

File

vendor/symfony/validator/Constraints/Country.php, line 44

Class

Country
Validates a value is a valid ISO 3166-1 alpha-2 country code.

Namespace

Symfony\Component\Validator\Constraints

Code

public function __construct(?array $options = null, ?string $message = null, ?bool $alpha3 = null, ?array $groups = null, mixed $payload = null) {
    if (!class_exists(Countries::class)) {
        throw new LogicException('The Intl component is required to use the Country constraint. Try running "composer require symfony/intl".');
    }
    parent::__construct($options, $groups, $payload);
    $this->message = $message ?? $this->message;
    $this->alpha3 = $alpha3 ?? $this->alpha3;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal