File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed
DependencyInjection/Compiler Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 1111
1212namespace Symfony \Bundle \FrameworkBundle \DependencyInjection \Compiler ;
1313
14+ use Symfony \Bundle \FrameworkBundle \Templating \EngineInterface as FrameworkBundleEngineInterface ;
1415use Symfony \Component \DependencyInjection \ContainerBuilder ;
1516use Symfony \Component \DependencyInjection \Compiler \CompilerPassInterface ;
17+ use Symfony \Component \Templating \EngineInterface as ComponentEngineInterface ;
1618
1719class TemplatingPass implements CompilerPassInterface
1820{
@@ -22,6 +24,11 @@ public function process(ContainerBuilder $container)
2224 return ;
2325 }
2426
27+ if ($ container ->hasAlias ('templating ' )) {
28+ $ definition = $ container ->findDefinition ('templating ' );
29+ $ definition ->setAutowiringTypes (array (ComponentEngineInterface::class, FrameworkBundleEngineInterface::class));
30+ }
31+
2532 if ($ container ->hasDefinition ('templating.engine.php ' )) {
2633 $ helpers = array ();
2734 foreach ($ container ->findTaggedServiceIds ('templating.helper ' ) as $ id => $ attributes ) {
Original file line number Diff line number Diff line change 88 <service id =" templating.engine.delegating" class =" Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine" public =" false" >
99 <argument type =" service" id =" service_container" />
1010 <argument type =" collection" /> <!-- engines -->
11-
12- <autowiring-type >Symfony\Component\Templating\EngineInterface</autowiring-type >
13- <autowiring-type >Symfony\Bundle\FrameworkBundle\Templating\EngineInterface</autowiring-type >
1411 </service >
1512
1613 <service id =" templating.name_parser" class =" Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser" >
Original file line number Diff line number Diff line change 1313
1414use Doctrine \Common \Annotations \AnnotationReader ;
1515use Doctrine \Common \Annotations \CachedReader ;
16- use Symfony \Bundle \FrameworkBundle \Templating \DelegatingEngine ;
16+ use Symfony \Component \Templating \EngineInterface ;
17+ use Symfony \Bundle \FrameworkBundle \Templating \EngineInterface as FrameworkBundleEngineInterface ;
1718
1819class AutowiringTypesTest extends WebTestCase
1920{
@@ -41,8 +42,8 @@ public function testTemplatingAutowiring()
4142 $ container = static ::$ kernel ->getContainer ();
4243
4344 $ autowiredServices = $ container ->get ('test.autowiring_types.autowired_services ' );
44- $ this ->assertInstanceOf (DelegatingEngine ::class, $ autowiredServices ->getFrameworkBundleEngine ());
45- $ this ->assertInstanceOf (DelegatingEngine ::class, $ autowiredServices ->getEngine ());
45+ $ this ->assertInstanceOf (FrameworkBundleEngineInterface ::class, $ autowiredServices ->getFrameworkBundleEngine ());
46+ $ this ->assertInstanceOf (EngineInterface ::class, $ autowiredServices ->getEngine ());
4647 }
4748
4849 protected static function createKernel (array $ options = array ())
You can’t perform that action at this time.
0 commit comments