By alexpott on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
10.0.x
Introduced in version:
10.0.0
Issue links:
Description:
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 {
Keeping compatiblity with Drupal 9 / psr/log v1
As long as the return typehint is implemented then it is possible to be compatible with Drupal 9 & 10. Changing ::log to have the void return type will make a logger compatible with both major versions.
public function log($level, $message, array $context = []): void {
Impacts:
Module developers