Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ae7de48

Browse filesBrowse files
committed
Clarify misleading comments regarding traversal of arrays
1 parent e9816f7 commit ae7de48
Copy full SHA for ae7de48

File tree

1 file changed

+4
-6
lines changed
Filter options

1 file changed

+4
-6
lines changed

‎src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,7 @@ private function validateObject($object, $propertyPath, array $groups, $traversa
352352
* Validates each object in a collection against the constraints defined
353353
* for their classes.
354354
*
355-
* If the parameter $recursive is set to true, nested {@link \Traversable}
356-
* objects are iterated as well. Nested arrays are always iterated,
357-
* regardless of the value of $recursive.
355+
* Nested arrays are also iterated.
358356
*
359357
* @param iterable $collection The collection
360358
* @param string $propertyPath The current property path
@@ -365,8 +363,7 @@ private function validateEachObjectIn($collection, $propertyPath, array $groups,
365363
{
366364
foreach ($collection as $key => $value) {
367365
if (\is_array($value)) {
368-
// Arrays are always cascaded, independent of the specified
369-
// traversal strategy
366+
// Also traverse nested arrays
370367
$this->validateEachObjectIn(
371368
$value,
372369
$propertyPath.'['.$key.']',
@@ -596,7 +593,8 @@ private function validateClassNode($object, $cacheKey, ClassMetadataInterface $m
596593
* in the passed metadata object. Then, if the value is an instance of
597594
* {@link \Traversable} and the selected traversal strategy permits it,
598595
* the value is traversed and each nested object validated against its own
599-
* constraints. Arrays are always traversed.
596+
* constraints. If the value is an array, it is traversed regardless of
597+
* the given strategy.
600598
*
601599
* @param mixed $value The validated value
602600
* @param object|null $object The current object

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.