comparison vendor/symfony/validator/Context/ExecutionContextInterface.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
10 */ 10 */
11 11
12 namespace Symfony\Component\Validator\Context; 12 namespace Symfony\Component\Validator\Context;
13 13
14 use Symfony\Component\Validator\Constraint; 14 use Symfony\Component\Validator\Constraint;
15 use Symfony\Component\Validator\ConstraintViolationListInterface;
15 use Symfony\Component\Validator\Mapping; 16 use Symfony\Component\Validator\Mapping;
16 use Symfony\Component\Validator\Mapping\MetadataInterface; 17 use Symfony\Component\Validator\Mapping\MetadataInterface;
17 use Symfony\Component\Validator\Validator\ValidatorInterface; 18 use Symfony\Component\Validator\Validator\ValidatorInterface;
18 use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface; 19 use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface;
19 use Symfony\Component\Validator\ConstraintViolationListInterface;
20 20
21 /** 21 /**
22 * The context of a validation run. 22 * The context of a validation run.
23 * 23 *
24 * The context collects all violations generated during the validation. By 24 * The context collects all violations generated during the validation. By
65 * Adds a violation at the current node of the validation graph. 65 * Adds a violation at the current node of the validation graph.
66 * 66 *
67 * @param string $message The error message 67 * @param string $message The error message
68 * @param array $params The parameters substituted in the error message 68 * @param array $params The parameters substituted in the error message
69 */ 69 */
70 public function addViolation($message, array $params = array()); 70 public function addViolation($message, array $params = []);
71 71
72 /** 72 /**
73 * Returns a builder for adding a violation with extended information. 73 * Returns a builder for adding a violation with extended information.
74 * 74 *
75 * Call {@link ConstraintViolationBuilderInterface::addViolation()} to 75 * Call {@link ConstraintViolationBuilderInterface::addViolation()} to
84 * @param string $message The error message 84 * @param string $message The error message
85 * @param array $parameters The parameters substituted in the error message 85 * @param array $parameters The parameters substituted in the error message
86 * 86 *
87 * @return ConstraintViolationBuilderInterface The violation builder 87 * @return ConstraintViolationBuilderInterface The violation builder
88 */ 88 */
89 public function buildViolation($message, array $parameters = array()); 89 public function buildViolation($message, array $parameters = []);
90 90
91 /** 91 /**
92 * Returns the validator. 92 * Returns the validator.
93 * 93 *
94 * Useful if you want to validate additional constraints: 94 * Useful if you want to validate additional constraints:
95 * 95 *
96 * public function validate($value, Constraint $constraint) 96 * public function validate($value, Constraint $constraint)
97 * { 97 * {
98 * $validator = $this->context->getValidator(); 98 * $validator = $this->context->getValidator();
99 * 99 *
100 * $violations = $validator->validateValue($value, new Length(array('min' => 3))); 100 * $violations = $validator->validate($value, new Length(['min' => 3]));
101 * 101 *
102 * if (count($violations) > 0) { 102 * if (count($violations) > 0) {
103 * // ... 103 * // ...
104 * } 104 * }
105 * } 105 * }
110 110
111 /** 111 /**
112 * Returns the currently validated object. 112 * Returns the currently validated object.
113 * 113 *
114 * If the validator is currently validating a class constraint, the 114 * If the validator is currently validating a class constraint, the
115 * object of that class is returned. If it is a validating a property or 115 * object of that class is returned. If it is validating a property or
116 * getter constraint, the object that the property/getter belongs to is 116 * getter constraint, the object that the property/getter belongs to is
117 * returned. 117 * returned.
118 * 118 *
119 * In other cases, null is returned. 119 * In other cases, null is returned.
120 * 120 *