Phan\Language\Type::getTemplateParameterTypeMap PHP Method

getTemplateParameterTypeMap() public method

public getTemplateParameterTypeMap ( CodeBase $code_base ) : Type[]
$code_base Phan\CodeBase The code base to look up classes against
return Type[] A map from template type identifier to a concrete type
    public function getTemplateParameterTypeMap(CodeBase $code_base)
    {
        return $this->memoize(__METHOD__, function () use($code_base) {
            $fqsen = $this->asFQSEN();
            if (!$fqsen instanceof FullyQualifiedClassName) {
                return [];
            }
            assert($fqsen instanceof FullyQualifiedClassName);
            if (!$code_base->hasClassWithFQSEN($fqsen)) {
                return [];
            }
            $class = $code_base->getClassByFQSEN($fqsen);
            $class_template_type_list = $class->getTemplateTypeMap();
            $template_parameter_type_list = $this->getTemplateParameterTypeList();
            $map = [];
            foreach (array_keys($class->getTemplateTypeMap()) as $i => $identifier) {
                if (isset($template_parameter_type_list[$i])) {
                    $map[$identifier] = $template_parameter_type_list[$i];
                }
            }
            return $map;
        });
    }