Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / symfony / validator / Mapping / Factory / LazyLoadingMetadataFactory.php
index 79ad1f228b79f6030f67dc81cb51f1007eb3ef91..fbb8c66669fc4d53f72a7ea97c234a4e87d1a3fb 100644 (file)
@@ -38,18 +38,7 @@ use Symfony\Component\Validator\Mapping\Loader\LoaderInterface;
  */
 class LazyLoadingMetadataFactory implements MetadataFactoryInterface
 {
-    /**
-     * The loader for loading the class metadata.
-     *
-     * @var LoaderInterface|null
-     */
     protected $loader;
-
-    /**
-     * The cache for caching class metadata.
-     *
-     * @var CacheInterface|null
-     */
     protected $cache;
 
     /**
@@ -99,6 +88,10 @@ class LazyLoadingMetadataFactory implements MetadataFactoryInterface
             return $this->loadedClasses[$class];
         }
 
+        if (!class_exists($class) && !interface_exists($class, false)) {
+            throw new NoSuchMetadataException(sprintf('The class or interface "%s" does not exist.', $class));
+        }
+
         if (null !== $this->cache && false !== ($metadata = $this->cache->read($class))) {
             // Include constraints from the parent class
             $this->mergeConstraints($metadata);
@@ -106,10 +99,6 @@ class LazyLoadingMetadataFactory implements MetadataFactoryInterface
             return $this->loadedClasses[$class] = $metadata;
         }
 
-        if (!class_exists($class) && !interface_exists($class)) {
-            throw new NoSuchMetadataException(sprintf('The class or interface "%s" does not exist.', $class));
-        }
-
         $metadata = new ClassMetadata($class);
 
         if (null !== $this->loader) {
@@ -171,10 +160,6 @@ class LazyLoadingMetadataFactory implements MetadataFactoryInterface
 
         $class = ltrim(is_object($value) ? get_class($value) : $value, '\\');
 
-        if (class_exists($class) || interface_exists($class)) {
-            return true;
-        }
-
-        return false;
+        return class_exists($class) || interface_exists($class, false);
     }
 }