class NullValidator

@author Bernhard Schussek <bschussek@gmail.com>

@api

Hierarchy

Expanded class hierarchy of NullValidator

1 file declares its use of NullValidator
NullValidatorTest.php in drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/NullValidatorTest.php

File

drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Constraints/NullValidator.php, line 22

Namespace

Symfony\Component\Validator\Constraints
View source
class NullValidator extends ConstraintValidator {

  /**
   * {@inheritDoc}
   */
  public function validate($value, Constraint $constraint) {
    if (null !== $value) {
      $this->context
        ->addViolation($constraint->message, array(
        '{{ value }}' => $value,
      ));
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConstraintValidator::$context protected property
ConstraintValidator::initialize public function Initializes the constraint validator. Overrides ConstraintValidatorInterface::initialize 1
NullValidator::validate public function Checks if the passed value is valid. Overrides ConstraintValidatorInterface::validate