function IsNullValidator::validate
Overrides ConstraintValidatorInterface::validate
2 calls to IsNullValidator::validate()
- IsNullConstraintValidator::validate in core/
lib/ Drupal/ Core/ Validation/ Plugin/ Validation/ Constraint/ IsNullConstraintValidator.php - Checks if the passed value is valid.
- IsNullConstraintValidator::validate in core/
lib/ Drupal/ Core/ Validation/ Plugin/ Validation/ Constraint/ IsNullConstraintValidator.php - Checks if the passed value is valid.
1 method overrides IsNullValidator::validate()
- IsNullConstraintValidator::validate in core/
lib/ Drupal/ Core/ Validation/ Plugin/ Validation/ Constraint/ IsNullConstraintValidator.php - Checks if the passed value is valid.
File
-
vendor/
symfony/ validator/ Constraints/ IsNullValidator.php, line 23
Class
- IsNullValidator
- @author Bernhard Schussek <bschussek@gmail.com>
Namespace
Symfony\Component\Validator\ConstraintsCode
public function validate(mixed $value, Constraint $constraint) : void {
if (!$constraint instanceof IsNull) {
throw new UnexpectedTypeException($constraint, IsNull::class);
}
if (null !== $value) {
$this->context
->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setCode(IsNull::NOT_NULL_ERROR)
->addViolation();
}
}