PsiVariable (final PsiAssignmentExpression assignment) { final PsiExpression reference = assignment.getLExpression(); final PsiElement referencedElement = reference instanceof PsiReferenceExpression ? ((PsiReferenceExpression)reference).resolve() : null; return referencedElement instanceof PsiVariable ? (PsiVariable)referencedElement : null; }