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

Breadcrumb

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

function Validation::createCallable

Creates a callable chain of constraints.

File

vendor/symfony/validator/Validation.php, line 27

Class

Validation
Entry point for the Validator component.

Namespace

Symfony\Component\Validator

Code

public static function createCallable(Constraint|ValidatorInterface|null $constraintOrValidator = null, Constraint ...$constraints) : callable {
    $validator = self::createIsValidCallable($constraintOrValidator, ...$constraints);
    return static function ($value) use ($validator) {
        if (!$validator($value, $violations)) {
            throw new ValidationFailedException($value, $violations);
        }
        return $value;
    };
}

API Navigation

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