ComponentContext (@NotNull PsiForeachStatement statement, @NotNull Options options) { PsiStatement body = statement.getBody(); if (body == null) { return null; } PsiParameter parameter = statement.getIterationParameter(); PsiType parameterType = parameter.getType(); PsiExpression iteratedValue = statement.getIteratedValue(); if (iteratedValue == null) { return null; } PsiType iteratedType = JavaGenericsUtil.getCollectionItemType(iteratedValue); if (iteratedType == null || iteratedType instanceof PsiClassType classType && classType.isRaw()) { return null; } if (!PsiTypesUtil.compareTypes(parameterType, iteratedType, false)) { return null; } PsiSubstitutor substitutor = PsiSubstitutor.EMPTY; if (parameterType instanceof PsiClassType referenceType) { substitutor = referenceType.resolveGenerics().getSubstitutor(); } PsiClass parameterClass = PsiUtil.resolveClassInClassTypeOnly(parameterType); if (parameterClass == null) { return null; } return new ComponentContext(0, parameter, parameterClass, substitutor, statement, options, new ShowInfoFolder()); }