- Issue created by @mstrelan
The event_dispatcher
service currently has two aliases:
Psr\EventDispatcher\EventDispatcherInterface: '@event_dispatcher'
Symfony\Contracts\EventDispatcher\EventDispatcherInterface: '@event_dispatcher'
The concrete class Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher
implements Symfony\Component\EventDispatcher\EventDispatcherInterface
, which is more specific than the two interfaces that are aliasing the service.
This means if you want to autowire the service, phpstan will think you have the interface from Symfony\Contracts
, and you can't make use of methods from Symfony\Component
, such as ::addListener
and ::removeListener
.
Add a service alias:
Symfony\Component\EventDispatcher\EventDispatcherInterface: '@event_dispatcher'
Active
11.0 π₯
base system