Problem/Motivation

Having the following

PHP Fatal error:  Type of Drupal\checklistapi\Commands\ChecklistapiCommands::$logger must be ?Psr\Log\LoggerInterface (as in class Drush\Commands\DrushCommands) in /var/www/html/test/drupal10test/docroot/modules/contrib/checklistapi/src/Commands/ChecklistapiCommands.php on line 18

Change records

Update code that implements \Psr\Log\LoggerInterface due to Psr/Log version 3
#3272447: Update to PSR/log v3
#3264918: Update symfony/console to Symfony 6

Proposed resolution

Have a Drupal 9 and Drupal 10 compatible logger

As in Drupal Change records
All the methods that are on \Psr\Log\LoggerInterface have stricter typehints. Contrib and custom modules that provide logger implementations will need to be updated for Drupal 10.

Typically code that uses the \Drupal\Core\Logger\RfcLoggerTrait will only need to change:

public function log($level, $message, array $context = []) {
to

public function log($level, string|\Stringable $message, array $context = []): void {

Remaining tasks

  • N/A

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A
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

Rajab Natshah created an issue. See original summary.

rajab natshah’s picture

Title: Fix Drupal 10 - PHP Fatal error: Type of ChecklistapiCommands::$logger must be ?Psr\Log\LoggerInterfac » Fix Drupal 10 - PHP Fatal error: Type of ChecklistapiCommands::$logger must be ?Psr\Log\LoggerInterface
rajab natshah’s picture

Status: Active » Closed (duplicate)
Related issues: +#3310067: Use \Drush\Commands\DrushCommands::logger() in ChecklistapiCommands

This issue was fixed and committed in #3310067: Use \Drush\Commands\DrushCommands::logger() in ChecklistapiCommands
But not released yet.


Having a Real physical testing round for Checklist API 2.1.1 with Drupal ~10

Using the following commit patch as a TEMP fix for the 2.1.1 release
https://git.drupalcode.org/project/checklistapi/-/commit/4b02386.patch

Hoping for a release tag

chandu7929 made their first commit to this issue’s fork.

chandu7929’s picture

Just check this is included in 2.1.2