PsiEnumConstant (@Nullable PsiElement element) { if (element instanceof PsiReferenceExpression referenceExpression && referenceExpression.resolve() instanceof PsiEnumConstant enumConstant) { return enumConstant; } return null; }