annotate vendor/symfony/validator/Validator/ValidatorInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 129ea1e6d783
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 /*
Chris@0 4 * This file is part of the Symfony package.
Chris@0 5 *
Chris@0 6 * (c) Fabien Potencier <fabien@symfony.com>
Chris@0 7 *
Chris@0 8 * For the full copyright and license information, please view the LICENSE
Chris@0 9 * file that was distributed with this source code.
Chris@0 10 */
Chris@0 11
Chris@0 12 namespace Symfony\Component\Validator\Validator;
Chris@0 13
Chris@0 14 use Symfony\Component\Validator\Constraint;
Chris@17 15 use Symfony\Component\Validator\Constraints\GroupSequence;
Chris@0 16 use Symfony\Component\Validator\ConstraintViolationListInterface;
Chris@0 17 use Symfony\Component\Validator\Context\ExecutionContextInterface;
Chris@0 18 use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface;
Chris@0 19
Chris@0 20 /**
Chris@0 21 * Validates PHP values against constraints.
Chris@0 22 *
Chris@0 23 * @author Bernhard Schussek <bschussek@gmail.com>
Chris@0 24 */
Chris@0 25 interface ValidatorInterface extends MetadataFactoryInterface
Chris@0 26 {
Chris@0 27 /**
Chris@0 28 * Validates a value against a constraint or a list of constraints.
Chris@0 29 *
Chris@0 30 * If no constraint is passed, the constraint
Chris@0 31 * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
Chris@0 32 *
Chris@17 33 * @param mixed $value The value to validate
Chris@17 34 * @param Constraint|Constraint[] $constraints The constraint(s) to validate against
Chris@17 35 * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
Chris@0 36 *
Chris@0 37 * @return ConstraintViolationListInterface A list of constraint violations
Chris@0 38 * If the list is empty, validation
Chris@0 39 * succeeded
Chris@0 40 */
Chris@0 41 public function validate($value, $constraints = null, $groups = null);
Chris@0 42
Chris@0 43 /**
Chris@0 44 * Validates a property of an object against the constraints specified
Chris@0 45 * for this property.
Chris@0 46 *
Chris@17 47 * @param object $object The object
Chris@17 48 * @param string $propertyName The name of the validated property
Chris@17 49 * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
Chris@0 50 *
Chris@0 51 * @return ConstraintViolationListInterface A list of constraint violations
Chris@0 52 * If the list is empty, validation
Chris@0 53 * succeeded
Chris@0 54 */
Chris@0 55 public function validateProperty($object, $propertyName, $groups = null);
Chris@0 56
Chris@0 57 /**
Chris@0 58 * Validates a value against the constraints specified for an object's
Chris@0 59 * property.
Chris@0 60 *
Chris@17 61 * @param object|string $objectOrClass The object or its class name
Chris@17 62 * @param string $propertyName The name of the property
Chris@17 63 * @param mixed $value The value to validate against the property's constraints
Chris@17 64 * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed
Chris@0 65 *
Chris@0 66 * @return ConstraintViolationListInterface A list of constraint violations
Chris@0 67 * If the list is empty, validation
Chris@0 68 * succeeded
Chris@0 69 */
Chris@0 70 public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null);
Chris@0 71
Chris@0 72 /**
Chris@0 73 * Starts a new validation context and returns a validator for that context.
Chris@0 74 *
Chris@0 75 * The returned validator collects all violations generated within its
Chris@0 76 * context. You can access these violations with the
Chris@0 77 * {@link ContextualValidatorInterface::getViolations()} method.
Chris@0 78 *
Chris@0 79 * @return ContextualValidatorInterface The validator for the new context
Chris@0 80 */
Chris@0 81 public function startContext();
Chris@0 82
Chris@0 83 /**
Chris@0 84 * Returns a validator in the given execution context.
Chris@0 85 *
Chris@0 86 * The returned validator adds all generated violations to the given
Chris@0 87 * context.
Chris@0 88 *
Chris@0 89 * @return ContextualValidatorInterface The validator for that context
Chris@0 90 */
Chris@0 91 public function inContext(ExecutionContextInterface $context);
Chris@0 92 }