private static ModCommand doInline(@NotNull ActionContext context,
                                     @NotNull PsiVariable var,
                                     @Nullable PsiReferenceExpression refExpr,
                                     @NotNull InlineMode mode) {
    List<PsiReferenceExpression> allRefs =
      refExpr != null && mode == InlineMode.INLINE_ONE ? List.of(refExpr) :
      VariableAccessUtils.getVariableReferences(var);
    if (allRefs.isEmpty()) {
      return ModCommand.error(RefactoringBundle.message("variable.is.never.used", var.getName()));
    }
    if (var instanceof PsiLocalVariable local) {
      return inlineLocal(context, local, refExpr, allRefs, mode);
    }
    return inlinePattern(context, (PsiPatternVariable)var, refExpr, allRefs, mode);
  }
private static ModCommand doInline(@NotNull ActionContext context,
                                     @NotNull PsiVariable var,
                                     @Nullable PsiReferenceExpression refExpr,
                                     @NotNull InlineMode mode)