Skip to content

Commit eac0767

Browse files
committed
Clarify misleading comments regarding traversal of arrays
1 parent f41dd10 commit eac0767

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines 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)