Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 8bc362b

Browse files
committed
Fix Symfony 3.3 pre-compatibility
1 parent 924d116 commit 8bc362b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/DependencyInjection/CmfSeoExtension.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\Config\FileLocator;
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
1717
use Symfony\Component\DependencyInjection\Definition;
18+
use Symfony\Component\DependencyInjection\ChildDefinition;
1819
use Symfony\Component\DependencyInjection\DefinitionDecorator;
1920
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
2021
use Symfony\Component\DependencyInjection\Reference;
@@ -250,8 +251,15 @@ private function createRequestMatcher(ContainerBuilder $container, $path = null,
250251
$id = 'cmf_seo.error.request_matcher.'.md5($serialized).sha1($serialized);
251252

252253
if (!$container->hasDefinition($id)) {
254+
if (class_exists(ChildDefinition::class)) {
255+
$definition = new ChildDefinition('cmf_seo.error.request_matcher');
256+
} else {
257+
// BC with Symfony <3.3
258+
$definition = new DefinitionDecorator('cmf_seo.error.request_matcher');
259+
}
260+
253261
$container
254-
->setDefinition($id, new DefinitionDecorator('cmf_seo.error.request_matcher'))
262+
->setDefinition($id, $definition)
255263
->setArguments($arguments)
256264
;
257265
}

0 commit comments

Comments
 (0)