public static function resolveFile(string $metadataDir, string $metadataNamespace, string $className) : string
    {
        if (strpos($className, $metadataNamespace) !== 0) {
            throw new InvalidArgumentException(
                sprintf('The class "%s" is not part of the metadata namespace "%s"', $className, $metadataNamespace)
            );
        }

        // remove metadata namespace from class name
        $classNameRelativeToMetadataNamespace = substr($className, strlen($metadataNamespace));

        // remove namespace separators from remaining class name
        $fileName = str_replace('\\', '', $classNameRelativeToMetadataNamespace);

        return $metadataDir . DIRECTORY_SEPARATOR . $fileName . '.php';
    }