Declaration (@NotNull PsiDeclarationStatement declaration) { PsiElement[] declared = declaration.getDeclaredElements(); if (declared.length != 1) return null; PsiVariable lhs = tryCast(declared[0], PsiVariable.class); if (lhs == null) return null; PsiExpression rhs = lhs.getInitializer(); return rhs == null ? null : new Declaration(lhs, rhs); }