diff --git a/src/DependencyInjection/CmfSeoExtension.php b/src/DependencyInjection/CmfSeoExtension.php index 951ba763..340f70e5 100644 --- a/src/DependencyInjection/CmfSeoExtension.php +++ b/src/DependencyInjection/CmfSeoExtension.php @@ -15,6 +15,7 @@ use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\DefinitionDecorator; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\Reference; @@ -250,8 +251,15 @@ private function createRequestMatcher(ContainerBuilder $container, $path = null, $id = 'cmf_seo.error.request_matcher.'.md5($serialized).sha1($serialized); if (!$container->hasDefinition($id)) { + if (class_exists(ChildDefinition::class)) { + $definition = new ChildDefinition('cmf_seo.error.request_matcher'); + } else { + // BC with Symfony <3.3 + $definition = new DefinitionDecorator('cmf_seo.error.request_matcher'); + } + $container - ->setDefinition($id, new DefinitionDecorator('cmf_seo.error.request_matcher')) + ->setDefinition($id, $definition) ->setArguments($arguments) ; }