PsiLocalVariable (@Nullable PsiExpression expression) { expression = PsiUtil.skipParenthesizedExprDown(expression); PsiReferenceExpression referenceExpression = tryCast(expression, PsiReferenceExpression.class); if(referenceExpression == null) return null; return tryCast(referenceExpression.resolve(), PsiLocalVariable.class); }