@Override
    protected void applyFix(@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) {
      if (myName == null) {
        PsiElement castExpression = PsiTreeUtil.getParentOfType(element, PsiTypeCastExpression.class);
        if (castExpression == null) return;
        while (castExpression.getParent() instanceof PsiParenthesizedExpression parenthesizedExpression) {
          castExpression = parenthesizedExpression;
        }
        new CommentTracker().replace(castExpression, myPatternName);
      }
      else if (!myName.endsWith("()")) {
        PsiLocalVariable variable = PsiTreeUtil.getParentOfType(element, PsiLocalVariable.class);
        if (variable == null) return;
        if (VariableAccessUtils.variableIsAssigned(variable)) {
          new CommentTracker().replace(element, myPatternName);
          return;
        }
        List<PsiReferenceExpression> references = VariableAccessUtils.getVariableReferences(variable);
        for (PsiReferenceExpression ref : references) {
          ExpressionUtils.bindReferenceTo(ref, myPatternName);
        }
        new CommentTracker().deleteAndRestoreComments(variable);
      }
      else {
        new CommentTracker().replace(element, myPatternName);
      }
    }
@Override
    protected void applyFix(@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater)