Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / symfony / validator / Validator / RecursiveContextualValidator.php
index 838d12b4033fdfd4870ffc41631a252796d33869..d1166ad913d657450f61bc42766c80d14bd38792 100644 (file)
@@ -38,34 +38,11 @@ use Symfony\Component\Validator\Util\PropertyPath;
  */
 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 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
 
             $this->validateGenericNode(
                 $value,
-                null,
+                $previousObject,
                 is_object($value) ? spl_object_hash($value) : null,
                 $metadata,
                 $this->defaultPropertyPath,
@@ -261,11 +238,13 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
 
         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 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
             $this->validateGenericNode(
                 $value,
                 $object,
-                $cacheKey.':'.get_class($object).':'.$propertyName,
+                $cacheKey.':'.$class.':'.$propertyName,
                 $propertyMetadata,
                 $propertyPath,
                 $groups,
@@ -395,7 +374,7 @@ class RecursiveContextualValidator implements ContextualValidatorInterface
      * 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