void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiForeachStatementBase foreachStatementBase = updater.getWritable(myForEachStatement.getElement()); PsiParameter parameter = updater.getWritable(myParameter.getElement()); if (foreachStatementBase == null || parameter == null) { return; } Options options = new Options(maxNotUsedComponentCounts, maxComponentCounts, maxLevel, IntroduceVariableBase.createVarType() || forceUseVar, true); PsiType parameterType = parameter.getType(); PsiSubstitutor substitutor = PsiSubstitutor.EMPTY; if (parameterType instanceof PsiClassType referenceType) { substitutor = referenceType.resolveGenerics().getSubstitutor(); } PsiClass parameterClass = PsiUtil.resolveClassInClassTypeOnly(parameterType); if (parameterClass == null) { return; } ComponentContext componentContext = new ComponentContext(null, parameter, parameterClass, substitutor, foreachStatementBase, options, new ShowInfoFolder()); processComponentContext(componentContext, (currentContext, mapElements) -> { Map<String, List<String>> usedVariable = deleteVariablesAndMapToMethodCalls(mapElements, currentContext); PatternDefinition patternDefinition = createPatternDefinition(currentContext, usedVariable); if (patternDefinition == null) { return; } remapToPattern(patternDefinition, mapElements); replace(patternDefinition, currentContext); }); }