annotate vendor/symfony/validator/Validator/ValidatorInterface.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 1fec387a4317
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@0 15 use Symfony\Component\Validator\ConstraintViolationListInterface;
Chris@0 16 use Symfony\Component\Validator\Context\ExecutionContextInterface;
Chris@0 17 use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface;
Chris@0 18
Chris@0 19 /**
Chris@0 20 * Validates PHP values against constraints.
Chris@0 21 *
Chris@0 22 * @author Bernhard Schussek <bschussek@gmail.com>
Chris@0 23 */
Chris@0 24 interface ValidatorInterface extends MetadataFactoryInterface
Chris@0 25 {
Chris@0 26 /**
Chris@0 27 * Validates a value against a constraint or a list of constraints.
Chris@0 28 *
Chris@0 29 * If no constraint is passed, the constraint
Chris@0 30 * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
Chris@0 31 *
Chris@0 32 * @param mixed $value The value to validate
Chris@0 33 * @param Constraint|Constraint[] $constraints The constraint(s) to validate
Chris@0 34 * against
Chris@0 35 * @param array|null $groups The validation groups to
Chris@0 36 * validate. If none is given,
Chris@0 37 * "Default" is assumed
Chris@0 38 *
Chris@0 39 * @return ConstraintViolationListInterface A list of constraint violations
Chris@0 40 * If the list is empty, validation
Chris@0 41 * succeeded
Chris@0 42 */
Chris@0 43 public function validate($value, $constraints = null, $groups = null);
Chris@0 44
Chris@0 45 /**
Chris@0 46 * Validates a property of an object against the constraints specified
Chris@0 47 * for this property.
Chris@0 48 *
Chris@0 49 * @param object $object The object
Chris@0 50 * @param string $propertyName The name of the validated property
Chris@0 51 * @param array|null $groups The validation groups to validate. If
Chris@0 52 * none is given, "Default" is assumed
Chris@0 53 *
Chris@0 54 * @return ConstraintViolationListInterface A list of constraint violations
Chris@0 55 * If the list is empty, validation
Chris@0 56 * succeeded
Chris@0 57 */
Chris@0 58 public function validateProperty($object, $propertyName, $groups = null);
Chris@0 59
Chris@0 60 /**
Chris@0 61 * Validates a value against the constraints specified for an object's
Chris@0 62 * property.
Chris@0 63 *
Chris@0 64 * @param object|string $objectOrClass The object or its class name
Chris@0 65 * @param string $propertyName The name of the property
Chris@0 66 * @param mixed $value The value to validate against the
Chris@0 67 * property's constraints
Chris@0 68 * @param array|null $groups The validation groups to validate. If
Chris@0 69 * none is given, "Default" is assumed
Chris@0 70 *
Chris@0 71 * @return ConstraintViolationListInterface A list of constraint violations
Chris@0 72 * If the list is empty, validation
Chris@0 73 * succeeded
Chris@0 74 */
Chris@0 75 public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null);
Chris@0 76
Chris@0 77 /**
Chris@0 78 * Starts a new validation context and returns a validator for that context.
Chris@0 79 *
Chris@0 80 * The returned validator collects all violations generated within its
Chris@0 81 * context. You can access these violations with the
Chris@0 82 * {@link ContextualValidatorInterface::getViolations()} method.
Chris@0 83 *
Chris@0 84 * @return ContextualValidatorInterface The validator for the new context
Chris@0 85 */
Chris@0 86 public function startContext();
Chris@0 87
Chris@0 88 /**
Chris@0 89 * Returns a validator in the given execution context.
Chris@0 90 *
Chris@0 91 * The returned validator adds all generated violations to the given
Chris@0 92 * context.
Chris@0 93 *
Chris@0 94 * @param ExecutionContextInterface $context The execution context
Chris@0 95 *
Chris@0 96 * @return ContextualValidatorInterface The validator for that context
Chris@0 97 */
Chris@0 98 public function inContext(ExecutionContextInterface $context);
Chris@0 99 }