function Collection::initializeNestedConstraints
Overrides Composite::initializeNestedConstraints
File
-
vendor/
symfony/ validator/ Constraints/ Collection.php, line 58
Class
- Collection
- Validates a collection with constraints defined for specific keys.
Namespace
Symfony\Component\Validator\ConstraintsCode
protected function initializeNestedConstraints() : void {
parent::initializeNestedConstraints();
foreach ($this->fields as $fieldName => $field) {
// the XmlFileLoader and YamlFileLoader pass the field Optional
// and Required constraint as an array with exactly one element
if (\is_array($field) && 1 == \count($field)) {
$this->fields[$fieldName] = $field = $field[0];
}
if (!$field instanceof Optional && !$field instanceof Required) {
$this->fields[$fieldName] = new Required($field);
}
}
}