Model\Reorder\Data\ReorderOutput must be compatible with Magento\Sales\Model\Reorder\Reorder::execute(string $orderNumber, string $storeId): Magento\Sales\Model\Reorder\Data\ReorderOutput
I am getting the above error while trying to override the module. I am trying with the preference to override the execute method.
code:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Sales\Model\Reorder\Reorder" type="Test\CustomReorder\Model\Reorder\Reorder"/>
</config>
file:
<?php
namespace Test\CustomReorder\Model;
class Reorder extends \Magento\Sales\Model\Reorder\Reorder
{
public function execute(string $orderNumber, string $storeId): Data\ReorderOutput
{
$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/test.log');
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);
$logger->info('confirmed');
die('abc');
}
}