alma / alma-monthlypayments-magento2

Magento 2 Payment Gateway integration for Alma
Other
6 stars 9 forks source link

Method 'Alma\MonthlyPayments\Helpers\Logger::addRecord()' is not compatible with method 'Magento\Framework\Logger\Monolog::addRecord()' #59

Closed AlexandreBulete closed 2 years ago

AlexandreBulete commented 2 years ago

Hi,

After to install a new Magento 2.4.5 and add the alma/alma-monthlypayments-magento2 module on a php 8.1 server I had the error:

Method 'Alma\MonthlyPayments\Helpers\Logger::addRecord()' is not compatible with method 'Magento\Framework\Logger\Monolog::addRecord()'

Seems like that the Monolog dependency doesn't correspond to the expected Alma Helper method: To correct this I just changed this method to:

use Monolog\DateTimeImmutable;

/**
 * @param int $level
 * @param string $message
 * @param array $context
 * @param DateTimeImmutable $datetime Optional log date to log into the past or future
 * @return bool
 */
public function addRecord($level, $message, array $context = [], DateTimeImmutable $datetime = null): bool
{
    if (!$this->configHelper->canLog()) {
        return true;
    }

    return parent::addRecord($level, $message, $context, $datetime);
}

Maybe should be a futur update of this module?

Have a nice day.

Francois-Gomis commented 2 years ago

Hi , update is now online with the version 2.9.0. Thanks