final protected function reflectionTypeToType(ReflectionType $reflectionType, bool $isEntityId = false): Type
    {
        $name = $reflectionType->getName();
        if ($name === 'self') {
            $name = $this->metadata->name;
        }

        $type = $this->getTypeFromRegistry($name, $isEntityId);
        if (!$reflectionType->allowsNull()) {
            $type = Type::nonNull($type);
        }

        return $type;
    }