Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/validator/ConstraintViolationList.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 |
---|---|
19 class ConstraintViolationList implements \IteratorAggregate, ConstraintViolationListInterface | 19 class ConstraintViolationList implements \IteratorAggregate, ConstraintViolationListInterface |
20 { | 20 { |
21 /** | 21 /** |
22 * @var ConstraintViolationInterface[] | 22 * @var ConstraintViolationInterface[] |
23 */ | 23 */ |
24 private $violations = array(); | 24 private $violations = []; |
25 | 25 |
26 /** | 26 /** |
27 * Creates a new constraint violation list. | 27 * Creates a new constraint violation list. |
28 * | 28 * |
29 * @param ConstraintViolationInterface[] $violations The constraint violations to add to the list | 29 * @param ConstraintViolationInterface[] $violations The constraint violations to add to the list |
30 */ | 30 */ |
31 public function __construct(array $violations = array()) | 31 public function __construct(array $violations = []) |
32 { | 32 { |
33 foreach ($violations as $violation) { | 33 foreach ($violations as $violation) { |
34 $this->add($violation); | 34 $this->add($violation); |
35 } | 35 } |
36 } | 36 } |
118 /** | 118 /** |
119 * {@inheritdoc} | 119 * {@inheritdoc} |
120 */ | 120 */ |
121 public function count() | 121 public function count() |
122 { | 122 { |
123 return count($this->violations); | 123 return \count($this->violations); |
124 } | 124 } |
125 | 125 |
126 /** | 126 /** |
127 * {@inheritdoc} | 127 * {@inheritdoc} |
128 */ | 128 */ |
167 * @return static new instance which contains only specific errors | 167 * @return static new instance which contains only specific errors |
168 */ | 168 */ |
169 public function findByCodes($codes) | 169 public function findByCodes($codes) |
170 { | 170 { |
171 $codes = (array) $codes; | 171 $codes = (array) $codes; |
172 $violations = array(); | 172 $violations = []; |
173 foreach ($this as $violation) { | 173 foreach ($this as $violation) { |
174 if (in_array($violation->getCode(), $codes, true)) { | 174 if (\in_array($violation->getCode(), $codes, true)) { |
175 $violations[] = $violation; | 175 $violations[] = $violation; |
176 } | 176 } |
177 } | 177 } |
178 | 178 |
179 return new static($violations); | 179 return new static($violations); |