protected function getClassXType($root, $class, $path)
    {
        if ($type = $this->getFromCache($class, $path)) {
            return $type;
        }

        $root = is_object($root) ? $root : new $root;

        // If the class is in cache but not the specific path
        if (isset($this->classCache[$class])) {
            return null;
        }

        $classType = $root instanceof SelfExplanatory ?
                        $this->typeFactory->toType($root) :
                        $this->getFromExtension($class);

        if ($classType) {
            $this->putAllIntoCache($class, $classType);
            return $path ? $this->getClassXType($root, $class, $path) : $classType;
        }

        return null;
    }