Argument replacement not working for type object

When you trying to replace an argument type of a function, then you must remember that the replaced type class should also able to create the old argument type object.

Lets me give an example:

On your question, your argument1's type is Magento\Cms\Api\BlockRepositoryInterface.

So, you must have to use those interfaces Or Classes which extend Magento\Cms\Api\BlockRepositoryInterface as replace the type of argument1.

like: Magento\Cms\Model\BlockRepository which implement Magento\Cms\Api\BlockRepositoryInterface

But you have to try to use Magento\Catalog\Api\ProductRepositoryInterface Argument Replacement of argument1.That's why you are getting the error.

So, replace types is important during the implementing of type argument.

At Second case, scaler1 is the type of string and replace type also string. So it is working.


Can you please try in the following format this example is similar to yours and working for me:

<type name="Amasty\ShopbyBase\Model\UrlBuilder">
    <arguments>
        <argument name="urlAdapters" xsi:type="array">
            <item name="base" xsi:type="array">
                <item name="adapter" xsi:type="object">\Amasty\ShopbyBase\Model\UrlBuilder\Adapter</item>
                <item name="sort_order" xsi:type="string">100</item>
            </item>
        </argument>
    </arguments>
</type>