private function getClassName(string $name, string $type): ?string
    {
        foreach ($this->fields as $className => $definition) {
            foreach ($definition['names'] as $defName) {
                if ($defName === $name || ($defName[0] === '/' && preg_match($defName, $name))) {
                    return $className;
                }
            }

            if (in_array($type, $definition['types'])) {
                return $className;
            }
        }

        return $this->defaultType;
    }