boolean (PsiVariable psiVariable) { if (!(psiVariable instanceof PsiParameter parameter)) { return false; } if (!(parameter.getDeclarationScope() instanceof PsiForeachStatement)) { return false; } PsiTypeElement typeElement = parameter.getTypeElement(); return typeElement == null || !typeElement.isInferredType(); }