Skip to content

Commit

Permalink
Clarify misleading comments regarding traversal of arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
corphi committed Feb 3, 2019
1 parent 852c624 commit 4c57add
Showing 1 changed file with 4 additions and 6 deletions.
Expand Up @@ -352,9 +352,7 @@ private function validateObject($object, $propertyPath, array $groups, $traversa
* Validates each object in a collection against the constraints defined
* for their classes.
*
* If the parameter $recursive is set to true, nested {@link \Traversable}
* objects are iterated as well. Nested arrays are always iterated,
* regardless of the value of $recursive.
* Nested arrays are also iterated.
*
* @param iterable $collection The collection
* @param string $propertyPath The current property path
Expand All @@ -365,8 +363,7 @@ private function validateEachObjectIn($collection, $propertyPath, array $groups,
{
foreach ($collection as $key => $value) {
if (\is_array($value)) {
// Arrays are always cascaded, independent of the specified
// traversal strategy
// Also traverse nested arrays
$this->validateEachObjectIn(
$value,
$propertyPath.'['.$key.']',
Expand Down Expand Up @@ -596,7 +593,8 @@ private function validateClassNode($object, $cacheKey, ClassMetadataInterface $m
* in the passed metadata object. Then, if the value is an instance of
* {@link \Traversable} and the selected traversal strategy permits it,
* the value is traversed and each nested object validated against its own
* constraints. Arrays are always traversed.
* constraints. If the value is an array, it is traversed regardless of
* the given strategy.
*
* @param mixed $value The validated value
* @param object|null $object The current object
Expand Down

0 comments on commit 4c57add

Please sign in to comment.