Problem/Motivation
With D11 / D10.3
While testing #3432853: Add support for WebProfiler.
Return type
Fatal error: Declaration of Drupal\tracer\EventDispatcher\TraceableEventDispatcher::addListener($event_name, $listener, $priority = 0) must be compatible with Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::addListener($event_name, $listener, $priority = 0): void in /data/app/modules/contrib/tracer/src/EventDispatcher/TraceableEventDispatcher.php on line 62
PHP fatal: \Drupal\tracer\EventDispatcher\TraceableEventDispatcher::addListener needs to add a return type since #3407159: [11.x] Add void returns for Symfony 7
Service class replaced
\Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher is replaced by \Symfony\Component\EventDispatcher\EventDispatcher. Since #2909185: Replace ContainerAwareEventDispatcher with Symfony EventDispatcher
So this service needs to extend, or if possible decorate the original instead. So it always has the correct arguments.
Dependency injection (may ignore per above)
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Drupal\tracer\EventDispatcher\TraceableEventDispatcher::__construct(), 0 passed in /data/app/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 and at least 1 expected in /data/app/modules/contrib/tracer/src/EventDispatcher/TraceableEventDispatcher.php:49
The core service event_dispatcher no longer has any arguments, since #2909185: Replace ContainerAwareEventDispatcher with Symfony EventDispatcher
Comments
Comment #2
dpiComment #3
el7cosmosComment #4
lussolucaA working patch has been committed in #3350037: Use service decorators