diff vendor/symfony/validator/Validator/RecursiveContextualValidator.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children 129ea1e6d783
line wrap: on
line diff
--- a/vendor/symfony/validator/Validator/RecursiveContextualValidator.php	Mon Apr 23 09:33:26 2018 +0100
+++ b/vendor/symfony/validator/Validator/RecursiveContextualValidator.php	Mon Apr 23 09:46:53 2018 +0100
@@ -38,34 +38,11 @@
  */
 class RecursiveContextualValidator implements ContextualValidatorInterface
 {
-    /**
-     * @var ExecutionContextInterface
-     */
     private $context;
-
-    /**
-     * @var string
-     */
     private $defaultPropertyPath;
-
-    /**
-     * @var array
-     */
     private $defaultGroups;
-
-    /**
-     * @var MetadataFactoryInterface
-     */
     private $metadataFactory;
-
-    /**
-     * @var ConstraintValidatorFactoryInterface
-     */
     private $validatorFactory;
-
-    /**
-     * @var ObjectInitializerInterface[]
-     */
     private $objectInitializers;
 
     /**
@@ -131,7 +108,7 @@
 
             $this->validateGenericNode(
                 $value,
-                null,
+                $previousObject,
                 is_object($value) ? spl_object_hash($value) : null,
                 $metadata,
                 $this->defaultPropertyPath,
@@ -261,11 +238,13 @@
 
         if (is_object($objectOrClass)) {
             $object = $objectOrClass;
+            $class = get_class($object);
             $cacheKey = spl_object_hash($objectOrClass);
             $propertyPath = PropertyPath::append($this->defaultPropertyPath, $propertyName);
         } else {
             // $objectOrClass contains a class name
             $object = null;
+            $class = $objectOrClass;
             $cacheKey = null;
             $propertyPath = $this->defaultPropertyPath;
         }
@@ -280,7 +259,7 @@
             $this->validateGenericNode(
                 $value,
                 $object,
-                $cacheKey.':'.get_class($object).':'.$propertyName,
+                $cacheKey.':'.$class.':'.$propertyName,
                 $propertyMetadata,
                 $propertyPath,
                 $groups,
@@ -395,7 +374,7 @@
      * objects are iterated as well. Nested arrays are always iterated,
      * regardless of the value of $recursive.
      *
-     * @param array|\Traversable        $collection   The collection
+     * @param iterable                  $collection   The collection
      * @param string                    $propertyPath The current property path
      * @param string[]                  $groups       The validated groups
      * @param ExecutionContextInterface $context      The current execution context