phpstan-drupal
phpstan-drupal copied to clipboard
Do not allow loggers to be class properties if set from logger factory
Loggers will break serialization if they're set from the LoggerFactory and not a defined logger channel service.
Background: https://www.drupal.org/project/commerce/issues/3038430
You can serialize a class in Drupal with a logger, but only if it was retrieved directly from the container. See https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21DependencyInjection%21DependencySerializationTrait.php/trait/DependencySerializationTrait/8.2.x