Skip to content

Declaration of LoggerTrait::log no longer matches Drupal\Core\Logger\RfcLoggerTrait::log

Describe the bug When running tests against Drupal 10, receive the error

PHP Fatal error:  Declaration of weitzman\DrupalTestTraits\LoggerTrait::log($level, $message, array $context = []) must be compatible with Drupal\Core\Logger\RfcLoggerTrait::log($level, Stringable|string $message, array $context = []): void in /tmp/test/atools/install/vendor/weitzman/drupal-test-traits/src/LoggerTrait.php on line 32

It seems the abstract definition in core/lib/Drupal/Core/Logger/RfcLoggerTrait.php has changed to

  /**
   * {@inheritdoc}
   */
  abstract public function log($level, string|\Stringable $message, array $context = []): void;

To Reproduce Steps to reproduce the behavior:

  1. Install Drupal > 10.0
  2. Run an ExistingSite test which includes a logger.

Expected behavior

Expecting no errors thrown

Screenshots

tests.sh___transporter_2023-04-17_13-21-58

Desktop (please complete the following information):

  • OS: MacOS
  • Browser N/A
  • Version N/A

Additional context

This is occurring locally in DDEV and Docker Desktop.

Edited by Mark Casias
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information