Closed
Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 3.3 |
ContainerAwareEventDispatcher is deprecated but the event_dispatcher
service still relies on it for BC, triggering a deprecation in any user code that makes use of the service.
To reproduce, apply the following patch on this repository:
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
index 51f97a5..a2df6c9 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
@@ -878,6 +878,18 @@ abstract class FrameworkExtensionTest extends TestCase
$this->assertTrue($container->has('property_info'));
}
+ public function testEventDispatcherDecoration()
+ {
+ $container = $this->createContainer(array('kernel.charset' => 'UTF-8', 'kernel.secret' => 'secret'));
+ $container->registerExtension(new FrameworkExtension());
+ $this->loadFromFile($container, 'default_config');
+ $container
+ ->register('foo', \stdClass::class)
+ ->setProperty('dispatcher', new Reference('event_dispatcher'));
+ $container->compile();
+ $container->get('foo');
+ }
+
public function testCacheDefaultRedisProvider()
{
$container = $this->createContainerFromFile('cache');
Then run ./phpunit src/Symfony/Bundle/FrameworkBundle
Output:
Remaining deprecation notices (3)
The "event_dispatcher" service relies on the deprecated "Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher" class. It should either be deprecated or its implementation upgraded: 3x
Not sure about the better way to fix it, hence the issue.