boolean ( PsiStatement statement, PsiVariable iterator, PsiType contentType) { if (!(statement instanceof PsiDeclarationStatement declarationStatement)) { return false; } final PsiElement[] declaredElements = declarationStatement.getDeclaredElements(); if (declaredElements.length != 1) { return false; } final PsiElement declaredElement = declaredElements[0]; if (!(declaredElement instanceof PsiVariable variable)) { return false; } final PsiExpression initializer = variable.getInitializer(); return isIteratorNext(initializer, iterator, contentType); }