magento2 – Magento 2 prevent discount on gift card products

Here is the below code di.xml to add plugin code :

app/code/VendorName/ModuleName/etc/di.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <type name="MagentoSalesRuleModelRulesApplier">
        <plugin name="sales_apply_plugin"
            type="VendorNameModuleNamePluginSalesRuleModelRulesApplier"
            sortOrder="1"/>
    </type>
</config>

Create RulesApplier.php plugin file

app/code/VendorName/ModuleName/Plugin/SalesRule/Model/RulesApplier.php

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

namespace VendorNameModuleNamePluginSalesRuleModel;
use MagentoGiftCardModelCatalogProductTypeGiftcard as GiftCardType;
class RulesApplier
{
  
    public function aroundApplyRules(
        MagentoSalesRuleModelRulesApplier $subject,
        Closure $proceed,
        $item,
        $rules,
        $skipValidation,
        $couponCode
    ) {
        $product = $item->getProductType();
    if ($product == GiftCardType::TYPE_GIFTCARD) {
        return;
    }
        $result = $proceed($item, $rules, $skipValidation, $couponCode);
        return $result;
    }
}

Getting error – TypeError: Argument 2 passed to MagentoSalesRuleModelRulesApplier::setAppliedRuleIds()