function BlankValidator::validate
Overrides ConstraintValidatorInterface::validate
File
-
vendor/
symfony/ validator/ Constraints/ BlankValidator.php, line 23
Class
- BlankValidator
- @author Bernhard Schussek <bschussek@gmail.com>
Namespace
Symfony\Component\Validator\ConstraintsCode
public function validate(mixed $value, Constraint $constraint) : void {
if (!$constraint instanceof Blank) {
throw new UnexpectedTypeException($constraint, Blank::class);
}
if ('' !== $value && null !== $value) {
$this->context
->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(Blank::NOT_BLANK_ERROR)
->addViolation();
}
}