Incompatibility with Monolog

Created on 19 September 2024, 2 months ago

There seems to be an incompatibility with the Monolog module. Looks like it's caused by the wrong return type of \Drupal\external_entities\Entity\ExternalEntityType::getLogger().

Easy way to trigger it (when Monolog is installed):
$ drush ev "\Drupal::entityTypeManager()->getStorage('external_entity_type')->load('my_external_entity_type')->getFieldMapper('an_unexisting_field')"

Result:

TypeError: Drupal\external_entities\Entity\ExternalEntityType::getLogger(): Return value must be of type Drupal\Core\Logger\LoggerChannel, Drupal\monolog\Logger\LoggerInterfacesAdapter returned in /app/web/modules/contrib/external_entities/src/Entity/ExternalEntityType.php on line 318 #0 /app/web/modules/contrib/external_entities/src/Entity/ExternalEntityType.php(533): Drupal\external_entities\Entity\ExternalEntityType->getLogger()
#1 /app/vendor/drush/drush/src/Commands/core/PhpCommands.php(32) : eval()'d code(1): Drupal\external_entities\Entity\ExternalEntityType->getFieldMapper()
#2 /app/vendor/drush/drush/src/Commands/core/PhpCommands.php(32): eval()
#3 [internal function]: Drush\Commands\core\PhpCommands->evaluate()
#4 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
#5 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
#6 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
#7 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process()
#8 /app/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#9 /app/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run()
#10 /app/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#11 /app/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#12 /app/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
#13 /app/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
#14 /app/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
#15 /app/vendor/drush/drush/drush(4): require('...')
#16 {main}
TypeError: Drupal\external_entities\Entity\ExternalEntityType::getLogger(): Return value must be of type Drupal\Core\Logger\LoggerChannel, Drupal\monolog\Logger\LoggerInterfacesAdapter returned in Drupal\external_entities\Entity\ExternalEntityType->getLogger() (line 318 of /app/web/modules/contrib/external_entities/src/Entity/ExternalEntityType.php).
 [warning] Drush command terminated abnormally.

The return type should be \Psr\Log\LoggerInterface.

🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

🇧🇪Belgium rp7

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024