@param  array<string, array<string, array{Type\Union}>> $template_types
@param  array<string, array<string, array{Type\Union, 1?: int}>> $generic_params
@param  Type\Union|null      $input_type

@return void
160866
public function replaceTemplateTypesWithStandins(
        array &$template_types,
        array &$generic_params,
        Codebase $codebase = null,
        Type\Union $input_type = null,
        bool $replace = true,
        bool $add_upper_bound = false,
        int $depth = 0
    ) {
        $keys_to_unset = [];

        foreach ($this->types as $key => $atomic_type) {
            if ($atomic_type instanceof Type\Atomic\TTemplateParam
                && isset($template_types[$key][$atomic_type->defining_class ?: ''])
            ) {
                $template_type = $template_types[$key][$atomic_type->defining_class ?: ''][0];

                if ($template_type->getId() !== $key) {
                    $replacement_type = $template_type;

                    if ($replace) {
                        if ($replacement_type->hasMixed()
                            && !$atomic_type->as->hasMixed()
                        ) {
                            foreach ($atomic_type->as->getTypes() as $as_atomic_type) {
                                $this->types[$as_atomic_type->getKey()] = clone $as_atomic_type;
                            }
                        } else {
                            foreach ($replacement_type->getTypes() as $replacement_atomic_type) {
                                $this->types[$replacement_atomic_type->getKey()] = clone $replacement_atomic_type;
                            }

                            foreach ($replacement_type->getTypes() as $replacement_key => $_) {
                                if ($replacement_key !== $key) {
                                    $keys_to_unset[] = $key;
                                }
                            }
                        }

                        if ($input_type) {
                            $generic_param = clone $input_type;
                            $generic_param->setFromDocblock();

                            if (isset($generic_params[$key][$atomic_type->defining_class ?: ''][0])) {
                                $existing_depth = $generic_params[$key][$atomic_type->defining_class ?: ''][1] ?? -1;
                                if ($existing_depth > $depth) {
                                    continue;
                                }

                                if ($existing_depth === $depth) {
                                    $generic_param = Type::combineUnionTypes(
                                        $generic_params[$key][$atomic_type->defining_class ?: ''][0],
                                        $generic_param,
                                        $codebase
                                    );
                                }
                            }

                            $generic_params[$key][$atomic_type->defining_class ?: ''] = [
                                $generic_param,
                                $depth
                            ];
                        }
                    } elseif ($add_upper_bound && $input_type) {
                        if ($codebase
                            && TypeAnalyzer::isContainedBy(
                                $codebase,
                                $input_type,
                                $replacement_type
                            )
                        ) {
                            $template_types[$key][$atomic_type->defining_class ?: ''][0] = clone $input_type;
                        }
                    }
                }
            } elseif ($atomic_type instanceof Type\Atomic\TTemplateParamClass
                && isset($template_types[$atomic_type->param_name])
            ) {
                if ($replace) {
                    $class_string = new Type\Atomic\TClassString($atomic_type->as, $atomic_type->as_type);

                    $keys_to_unset[] = $key;

                    $this->types[$class_string->getKey()] = $class_string;

                    if ($input_type) {
                        $valid_input_atomic_types = [];

                        foreach ($input_type->getTypes() as $input_atomic_type) {
                            if ($input_atomic_type instanceof Type\Atomic\TLiteralClassString) {
                                $valid_input_atomic_types[] = new Type\Atomic\TNamedObject(
                                    $input_atomic_type->value
                                );
                            } elseif ($input_atomic_type instanceof Type\Atomic\TTemplateParamClass) {
                                $valid_input_atomic_types[] = new Type\Atomic\TTemplateParam(
                                    $input_atomic_type->param_name,
                                    $input_atomic_type->as_type
                                        ? new Union([$input_atomic_type->as_type])
                                        : ($input_atomic_type->as === 'object'
                                            ? Type::getObject()
                                            : Type::getMixed())
                                );
                            } elseif ($input_atomic_type instanceof Type\Atomic\TClassString) {
                                if ($input_atomic_type->as_type) {
                                    $valid_input_atomic_types[] = clone $input_atomic_type->as_type;
                                } elseif ($input_atomic_type->as !== 'object') {
                                    $valid_input_atomic_types[] = new Type\Atomic\TNamedObject(
                                        $input_atomic_type->as
                                    );
                                }
                            }
                        }

                        if ($valid_input_atomic_types) {
                            $generic_param = new Union($valid_input_atomic_types);
                            $generic_param->setFromDocblock();
                        } else {
                            $generic_param = Type::getMixed();
                        }

                        $generic_params[$atomic_type->param_name][$atomic_type->defining_class ?: ''] = [
                            $generic_param,
                            $depth
                        ];
                    }
                }
            } else {
                $matching_atomic_type = null;

                if ($input_type && $codebase) {
                    foreach ($input_type->types as $input_key => $atomic_input_type) {
                        if ($input_key === $key) {
                            $matching_atomic_type = $atomic_input_type;
                            break;
                        }

                        if ($input_key === 'Closure' && $key === 'callable') {
                            $matching_atomic_type = $atomic_input_type;
                            break;
                        }

                        if (($atomic_input_type instanceof Type\Atomic\TArray
                                || $atomic_input_type instanceof Type\Atomic\ObjectLike)
                            && $key === 'iterable'
                        ) {
                            $matching_atomic_type = $atomic_input_type;
                            break;
                        }

                        if (strpos($input_key, $key . '&') === 0) {
                            $matching_atomic_type = $atomic_input_type;
                            break;
                        }

                        if ($key === 'callable') {
                            $matching_atomic_type = TypeAnalyzer::getCallableFromAtomic(
                                $codebase,
                                $atomic_input_type
                            );

                            if ($matching_atomic_type) {
                                break;
                            }
                        }

                        if ($atomic_input_type instanceof TNamedObject && $atomic_type instanceof TNamedObject) {
                            try {
                                $classlike_storage =
                                    $codebase->classlike_storage_provider->get($atomic_input_type->value);

                                if ($atomic_input_type instanceof TGenericObject
                                    && isset($classlike_storage->template_type_extends[strtolower($key)])
                                ) {
                                    $matching_atomic_type = $atomic_input_type;
                                    break;
                                }

                                if (isset($classlike_storage->template_type_extends[strtolower($key)])) {
                                    $extends_list = $classlike_storage->template_type_extends[strtolower($key)];

                                    $new_generic_params = [];

                                    foreach ($extends_list as $key => $value) {
                                        if (is_string($key)) {
                                            $new_generic_params[] = $value;
                                        }
                                    }

                                    $matching_atomic_type = new TGenericObject(
                                        $atomic_input_type->value,
                                        $new_generic_params
                                    );
                                    break;
                                }
                            } catch (\InvalidArgumentException $e) {
                                // do nothing
                            }
                        }
                    }
                }

                $atomic_type->replaceTemplateTypesWithStandins(
                    $template_types,
                    $generic_params,
                    $codebase,
                    $matching_atomic_type,
                    $replace,
                    $add_upper_bound,
                    $depth + 1
                );
            }
        }

        if ($replace) {
            foreach ($keys_to_unset as $key) {
                unset($this->types[$key]);
            }

            if (!$this->types) {
                throw new \UnexpectedValueException('Cannot remove all keys');
            }

            $this->id = null;
        }
    }
707900
private void registerTemplates(Iterable<TemplateType> templates, @Nullable Node scopeRoot) {
    if (!Iterables.isEmpty(templates)) {
      // Add any templates from JSDoc into our template scope.
      this.templateScope = typeRegistry.createScopeWithTemplates(templateScope, templates);
      // Register the template types on the scope root node, if there is one.
      if (scopeRoot != null) {
        typeRegistry.registerTemplateTypeNamesInScope(templates, scopeRoot);
      }
    }
  }
1209789
private Node createTemplateParameterNode(int index, JSType type, boolean isStringLiteral) {
    checkState(index >= 0);
    checkNotNull(type);
    Node n = Node.newNumber(index);
    if (isStringLiteral) {
      n.setToken(TEMPLATE_STRING_LITERAL);
    } else {
      n.setToken(TEMPLATE_TYPE_PARAM);
    }
    n.setJSType(type);
    return n;
  }
753419
public function setTemplateType(TemplateTypeInterface $templateType)
    {
        $this->templateTypeId = $templateType->getId();

        return parent::setTemplateType($templateType);
    }
1066621
def add_typeattr(typeattr,**kwargs):
    

    tmpltype = get_templatetype(typeattr.type_id, user_id=kwargs.get('user_id'))

    ta = _set_typeattr(typeattr)

    tmpltype.typeattrs.append(ta)

    db.DBSession.flush()

    return ta
63905
public void setTemplateVars(List<TemplateVar> templateVars) {
		this.templateVars.clear();
		if(templateVars != null && !templateVars.isEmpty()) {
			this.templateVars.addAll(templateVars);
		}
	}
810943
private function validatePageTemplate($type, $template)
    {
        $status = '<info>ok</info>';

        try {
            $this->validateStructure($type, $template);
        } catch (\Exception $e) {
            $status = sprintf('<error>failed: %s</error>', $e->getMessage());
            $this->errors[] = $e->getMessage();
        }

        $this->output->writeln(
            sprintf(
                '    %s: %s -> %s',
                $type,
                $template,
                $status
            )
        );
    }
320321
private String genericTypeAsString(GenericsType genericsType, boolean showRedirect) {
        String ret = genericsType.getName();
        if (genericsType.getUpperBounds() != null) {
            ret += " extends ";
            for (int i = 0; i < genericsType.getUpperBounds().length; i++) {
                ClassNode classNode = genericsType.getUpperBounds()[i];
                if (classNode.equals(this)) {
                    ret += classNode.getName();
                } else {
                    ret += classNode.toString(showRedirect);
                }
                if (i + 1 < genericsType.getUpperBounds().length) ret += " & ";
            }
        } else if (genericsType.getLowerBound() !=null) {
            ClassNode classNode = genericsType.getLowerBound();
            if (classNode.equals(this)) {
                ret += " super " + classNode.getName();
            } else {
                ret += " super " + classNode;
            }
        }
        return ret;
    }
359509
private void checkValueType(TemplateParam param, SoyValue value, TemplateNode node) {
    if (!TofuTypeChecks.isInstance(param.type(), value, node.getSourceLocation())) {
      // should this be a soydataexception?
      throw RenderException.createWithSource(
          "Parameter type mismatch: attempt to bind value '"
              + (value instanceof UndefinedData ? "(undefined)" : value)
              + "' (a "
              + value.getClass().getSimpleName()
              + ") to parameter '"
              + param.name()
              + "' which has a declared type of '"
              + param.type()
              + "'.",
          node);
    }
  }
780671
protected function renderTemplateInput($type,$inputParam,$baseUrl,$jsParam){
        $options = $this->{$type.'LiInputOptions'};
        $linkWrapTag = ArrayHelper::remove($options , 'tag' , 'li');
        Html::addCssClass($options, $this->{$type.'LiInputCssClass'});

        $inputParam=$type=='j'?($inputParam+1):$inputParam;
        $linkOptions = $this->{$type.'InputOptions'};
        $counter = self::${$type.'Counter'};
        $linkOptions['min'] = 1;

        $linkOptions['max'] = $type=='j'?$this->pagination->getPageCount():$this->pagination->pageSizeLimit[1];
        $linkOptions['id'] = $this->{$type.'InputIdHeader'}.$counter;
        $linkOptions['baseurl']=$baseUrl;

        if(empty($linkOptions['js'])){
            $this->renderJs($linkOptions['id'],$this->{$type.'ButtonIdHeader'}.$counter,$linkOptions['max'],$jsParam);
        }

        return Html::tag($linkWrapTag,Html::input($this->{$type.'InpuType'},empty($linkOptions['name'])?'name':$linkOptions['name'],$inputParam,$linkOptions),$options);

    }
499871
@SafeVarargs
    public static void registerFilterTypes(final Class<? extends DynamicFilter>... types) {
        FILTER_TYPES.addAll(Arrays.asList(types));
    }
1261825
public function bind_param($types, &$var1, &$_ = NULL, $stmt, $types, &$var1, &$_ = NULL)
    {
    }
68664
@Override
    public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException {
        if (params.size() > 1)
        {
            String message = "This directive doesn't allow multiple parameters.";
            errors.add(message);
            throw new TemplateModelException(message);
        }
        if (params.size() == 1 && !((Map.Entry)params.entrySet().toArray()[0]).getKey().equals("sql")) {
            String message = "This directive only takes 'sql', which you specify the type of engine, ie mysql, postgres, etc.";
            errors.add(message);
            throw new TemplateModelException(message);
        }
        Object sqlParam = params.get("sql");
        String engine = "mysql";
        if (sqlParam == null) { } else
        if (sqlParam instanceof TemplateScalarModel)
        {
            TemplateScalarModel engineParam = (TemplateScalarModel) sqlParam;
            engine = engineParam.getAsString();
        } else {
            String message = "This directive only accepts string values for 'sql'.";
            errors.add(message);
            throw new TemplateModelException(message);
        }
        if (loopVars.length != 0) throw new TemplateModelException("This directive doesn't allow loop variables.");
        limitExists[0] = true;
        int limit = freemarkerSQLDataReportConnector.getPageLimit();
        int offset = freemarkerSQLDataReportConnector.getPage() * limit;
        if (engine.equalsIgnoreCase("mysql") || engine.equalsIgnoreCase("postgres"))
        {
            env.getOut().write(" LIMIT " + limit + " OFFSET " + offset + " ");
        } else
        {
            String message = "Unknown SQL Engine " + engine + ".";
            errors.add(message);
            throw new TemplateModelException(message);
        }
    }
62927
public static HttpTemplate template(TemplateType type, String template) {
        return new HttpTemplate(type).withTemplate(template);
    }
576701
public function add(
        array $templates,
        WP_Theme $theme = null,
        $post,
        string $post_type
    ): array {
        $templates[$this->slug] = \esc_html__('Page builder (blank)', 'jentil');

        return $templates;
    }
1244561
public static <S, T extends Event> InputMapTemplate<S, T> ignore(
            EventType<? extends T> eventType) {
        return ignore(EventPattern.eventType(eventType));
    }
477836
private ParamTag[] paramTags(boolean typeParams) {
        ListBuffer<ParamTag> found = new ListBuffer<ParamTag>();
        for (Tag next : tagList) {
            if (next instanceof ParamTag) {
                ParamTag p = (ParamTag)next;
                if (typeParams == p.isTypeParameter()) {
                    found.append(p);
                }
            }
        }
        return found.toArray(new ParamTag[found.length()]);
    }