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\ValidatorCode
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;
};
}