PsiLocalVariable (PsiStatement statement, PsiStatement body) { PsiLocalVariable localVariable = IteratorDeclaration.getDeclaredVariable(statement); if (localVariable == null) return null; List<PsiReferenceExpression> references = VariableAccessUtils.getVariableReferences(localVariable, body); return references.size() != 1 ? null : localVariable; }