Problem/Motivation

Upon enabling Push Logs, a fatal error is generated:

Fatal error: Declaration of Drupal\push_logs\Logger\PushedLog::log($level, $message, array $context = []) must be compatible with Drupal\Core\Logger\RfcLoggerTrait::log($level, Stringable|string $message, array $context = []): void in /------/------/modules/contrib/push_logs/src/Logger/PushedLog.php on line 79

Steps to reproduce

  1. Install Push Logs via Composer:
    composer require 'drupal/push_logs:^1.0'
  2. Enable Push Logs with Drupal 10 UI.
  3. Immediate fatal error:
    Fatal error: Declaration of Drupal\push_logs\Logger\PushedLog::log($level, $message, array $context = []) must be compatible with Drupal\Core\Logger\RfcLoggerTrait::log($level, Stringable|string $message, array $context = []): void in /------/------/web/modules/contrib/push_logs/src/Logger/PushedLog.php on line 79

Proposed resolution

From that I can see, it appears to be a matter of adding a "void" to the function argument default values:

public function log($level, $message, array $context = []): void {
vs.
public function log($level, $message, array $context = []) {

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Issue fork push_logs-3362244

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

emathy created an issue. See original summary.

emathy’s picture

Issue summary: View changes

R_H-L made their first commit to this issue’s fork.

  • R_H-L committed 8c1fcfe1 on 1.0.x authored by emathy
    Issue #3362244 by emathy: Fatal Error RfcLoggerTrait::Log
    
r_h-l’s picture

Commit looks good, merged and new release created. Thank you!

r_h-l’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.