public static boolean isVariableCompared(@NotNull PsiVariable variable, @Nullable PsiExpression expression) {
    if (!(expression instanceof PsiBinaryExpression binaryExpression)) {
      return false;
    }
    final IElementType tokenType = binaryExpression.getOperationTokenType();
    if (!ComparisonUtils.isComparisonOperation(tokenType)) {
      return false;
    }
    final PsiExpression lhs = binaryExpression.getLOperand();
    final PsiExpression rhs = binaryExpression.getROperand();
    if (rhs == null) {
      return false;
    }
    if (ExpressionUtils.isReferenceTo(lhs, variable)) {
      return true;
    }
    else if (ExpressionUtils.isReferenceTo(rhs, variable)) {
      return true;
    }
    return false;
  }
public static boolean isVariableCompared(@NotNull PsiVariable variable, @Nullable PsiExpression expression)