You are here

interface ValidatorInterface in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/validator/ValidatorInterface.php \Symfony\Component\Validator\ValidatorInterface
  2. 8 vendor/symfony/validator/Validator/ValidatorInterface.php \Symfony\Component\Validator\Validator\ValidatorInterface
Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Validator/ValidatorInterface.php \Symfony\Component\Validator\Validator\ValidatorInterface

Validates PHP values against constraints.

@since 2.5

@author Bernhard Schussek <bschussek@gmail.com>

Hierarchy

Expanded class hierarchy of ValidatorInterface

All classes that implement ValidatorInterface

13 files declare their use of ValidatorInterface
Abstract2Dot5ApiTest.php in vendor/symfony/validator/Tests/Validator/Abstract2Dot5ApiTest.php
ExecutionContext.php in vendor/symfony/validator/Context/ExecutionContext.php
ExecutionContext.php in core/lib/Drupal/Core/TypedData/Validation/ExecutionContext.php
Contains \Drupal\Core\TypedData\Validation\ExecutionContext.
ExecutionContextFactory.php in vendor/symfony/validator/Context/ExecutionContextFactory.php
ExecutionContextFactory.php in core/lib/Drupal/Core/TypedData/Validation/ExecutionContextFactory.php
Contains \Drupal\Core\TypedData\Validation\ExecutionContextFactory.

... See full list

File

vendor/symfony/validator/Validator/ValidatorInterface.php, line 26

Namespace

Symfony\Component\Validator\Validator
View source
interface ValidatorInterface extends MetadataFactoryInterface {

  /**
   * Validates a value against a constraint or a list of constraints.
   *
   * If no constraint is passed, the constraint
   * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
   *
   * @param mixed                   $value       The value to validate
   * @param Constraint|Constraint[] $constraints The constraint(s) to validate
   *                                             against
   * @param array|null              $groups      The validation groups to
   *                                             validate. If none is given,
   *                                             "Default" is assumed
   *
   * @return ConstraintViolationListInterface A list of constraint violations.
   *                                          If the list is empty, validation
   *                                          succeeded
   */
  public function validate($value, $constraints = null, $groups = null);

  /**
   * Validates a property of an object against the constraints specified
   * for this property.
   *
   * @param object     $object       The object
   * @param string     $propertyName The name of the validated property
   * @param array|null $groups       The validation groups to validate. If
   *                                 none is given, "Default" is assumed
   *
   * @return ConstraintViolationListInterface A list of constraint violations.
   *                                          If the list is empty, validation
   *                                          succeeded
   */
  public function validateProperty($object, $propertyName, $groups = null);

  /**
   * Validates a value against the constraints specified for an object's
   * property.
   *
   * @param object|string $objectOrClass The object or its class name
   * @param string        $propertyName  The name of the property
   * @param mixed         $value         The value to validate against the
   *                                     property's constraints
   * @param array|null    $groups        The validation groups to validate. If
   *                                     none is given, "Default" is assumed
   *
   * @return ConstraintViolationListInterface A list of constraint violations.
   *                                          If the list is empty, validation
   *                                          succeeded
   */
  public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null);

  /**
   * Starts a new validation context and returns a validator for that context.
   *
   * The returned validator collects all violations generated within its
   * context. You can access these violations with the
   * {@link ContextualValidatorInterface::getViolations()} method.
   *
   * @return ContextualValidatorInterface The validator for the new context
   */
  public function startContext();

  /**
   * Returns a validator in the given execution context.
   *
   * The returned validator adds all generated violations to the given
   * context.
   *
   * @param ExecutionContextInterface $context The execution context
   *
   * @return ContextualValidatorInterface The validator for that context
   */
  public function inContext(ExecutionContextInterface $context);

}

Members

Namesort descending Modifiers Type Description Overrides
MetadataFactoryInterface::getMetadataFor public function Returns the metadata for the given value. 5
MetadataFactoryInterface::hasMetadataFor public function Returns whether the class is able to return metadata for the given value. 5
ValidatorInterface::inContext public function Returns a validator in the given execution context. 2
ValidatorInterface::startContext public function Starts a new validation context and returns a validator for that context. 2
ValidatorInterface::validate public function Validates a value against a constraint or a list of constraints.
ValidatorInterface::validateProperty public function Validates a property of an object against the constraints specified for this property.
ValidatorInterface::validatePropertyValue public function Validates a value against the constraints specified for an object's property.