class ExtensionNameConstraint

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Extension/Plugin/Validation/Constraint/ExtensionNameConstraint.php \Drupal\Core\Extension\Plugin\Validation\Constraint\ExtensionNameConstraint

Checks that the value is a valid extension name.

Hierarchy

  • class \Drupal\Core\Validation\Plugin\Validation\Constraint\RegexConstraint extends \Symfony\Component\Validator\Constraints\Regex
    • class \Drupal\Core\Extension\Plugin\Validation\Constraint\ExtensionNameConstraint extends \Drupal\Core\Validation\Plugin\Validation\Constraint\RegexConstraint

Expanded class hierarchy of ExtensionNameConstraint

File

core/lib/Drupal/Core/Extension/Plugin/Validation/Constraint/ExtensionNameConstraint.php, line 15

Namespace

Drupal\Core\Extension\Plugin\Validation\Constraint
View source
class ExtensionNameConstraint extends RegexConstraint {
    
    /**
     * Constructs an ExtensionNameConstraint object.
     *
     * @param string|array|null $pattern
     *   The regular expression to test for.
     * @param mixed ...$arguments
     *   Arguments to pass to the parent constructor.
     */
    public function __construct(string|array|null $pattern, ...$arguments) {
        // Always use the regular expression that ExtensionDiscovery uses to find
        // valid extensions.
        $pattern = ExtensionDiscovery::PHP_FUNCTION_PATTERN;
        parent::__construct($pattern, ...$arguments);
    }

}

Members

Title Sort descending Modifiers Object type Summary
ExtensionNameConstraint::__construct public function Constructs an ExtensionNameConstraint object.
RegexConstraint::validatedBy public function @todo Add method return type declaration.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.