void (@NotNull PsiForeachStatement statement) { super.visitForeachStatement(statement); ForEachCollectionTraversal traversal = ForEachCollectionTraversal.fromLoop(statement); if (traversal == null) return; PsiIfStatement ifStatement = tryCast(ControlFlowUtils.stripBraces(statement.getBody()), PsiIfStatement.class); if (ifStatement == null) return; PsiExpression condition = checkAndExtractCondition(traversal, ifStatement); if (condition == null) return; PsiJavaToken endToken = statement.getRParenth(); if (endToken == null) return; registerProblem(statement); }