void (final PsiType migrationType) { start(new RulesProvider() { @Override public PsiType migrationType(PsiElement context) { return migrationType; } @Override public PsiElement victim(final PsiClass aClass) { final PsiForeachStatement foreachStatement = PsiTreeUtil.findChildOfType(aClass, PsiForeachStatement.class); assert foreachStatement != null : aClass.getText(); return foreachStatement.getIterationParameter(); } }); }