src/Driver/ClassMapDriver.php
public function loadMetadataForClass($className, ClassMetadataInterface $metadata)
    {
        if (false === $metadata instanceof ClassMetadata) {
            throw new MappingException(
                sprintf('Metadata is of class "%s" instead of "%s"', get_class($metadata), ClassMetadata::class)
            );
        }

        if (false === isset($this->classMap[$className])) {
            throw new MappingException(
                sprintf('No configured mapping for document "%s"', $className)
            );
        }

        $mappingClassName = $this->classMap[$className];

        if (false === ($mapping = new $mappingClassName()) instanceof ClassMapMappingInterface) {
            throw new MappingException(
                sprintf('Class "%s" does not implement the "%s"', $mappingClassName, ClassMapMappingInterface::class)
            );
        }

        $mapping->configureMapping($metadata);
    }
public function loadMetadataForClass($className, ClassMetadataInterface $metadata)
    {
        if (false === $metadata instanceof ClassMetadata) {
            throw new MappingException(
                sprintf('Metadata is of class "%s" instead of "%s"', get_class($metadata), ClassMetadata::class)
            );
        }

        if (false === isset($this->classMap[$className])) {
            throw new MappingException(
                sprintf('No configured mapping for document "%s"', $className)
            );
        }

        $mappingClassName = $this->classMap[$className];

        if (false === ($mapping = new $mappingClassName()) instanceof ClassMapMappingInterface) {
            throw new MappingException(
                sprintf('Class "%s" does not implement the "%s"', $mappingClassName, ClassMapMappingInterface::class)
            );
        }

        $mapping->configureMapping($metadata);
    }
@param string                 $className
@param ClassMetadataInterface $metadata

@throws MappingException