PsiForeachStatement foreachStatement = (PsiForeachStatement)element;
PsiStatement body = foreachStatement.getBody();
final PsiExpression iteratedValue = foreachStatement.getIteratedValue();
if (body != null && iteratedValue != null) {
final PsiParameter parameter = foreachStatement.getIterationParameter();
<BUG>StreamApiMigrationInspection.TerminalBlock tb = StreamApiMigrationInspection.TerminalBlock.from(parameter, body);
if (!FileModificationService.getInstance().preparePsiElementForWrite(foreachStatement)) return;
List<Operation> operations = tb.extractOperations();
migrate(project, descriptor, foreachStatement, iteratedValue, body, tb, operations);
}</BUG>
}

PsiForeachStatement foreachStatement = (PsiForeachStatement)element;
PsiStatement body = foreachStatement.getBody();
final PsiExpression iteratedValue = foreachStatement.getIteratedValue();
if (body != null && iteratedValue != null) {
final PsiParameter parameter = foreachStatement.getIterationParameter();
TerminalBlock tb = TerminalBlock.from(parameter, body);
if (!FileModificationService.getInstance().preparePsiElementForWrite(foreachStatement)) return;
migrate(project, descriptor, foreachStatement, iteratedValue, body, tb);
