diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index d5f65ed..e417f22 100755 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -32,9 +32,14 @@ class Configuration implements ConfigurationInterface { public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder(); - $rootNode = $treeBuilder->root('uecode_qpush'); - + $treeBuilder = new TreeBuilder('uecode_qpush'); + if (\method_exists($treeBuilder, 'getRootNode')) { + $rootNode = $treeBuilder->getRootNode(); + } else { + // BC layer for symfony/config 4.1 and older + $rootNode = $treeBuilder->root('uecode_qpush'); + } + $rootNode ->addDefaultsIfNotSet() ->children() @@ -54,8 +59,14 @@ public function getConfigTreeBuilder() private function getProvidersNode() { - $treeBuilder = new TreeBuilder(); - $node = $treeBuilder->root('providers'); + $treeBuilder = new TreeBuilder('providers'); + if (\method_exists($treeBuilder, 'getRootNode')) { + $node = $treeBuilder->getRootNode(); + } else { + // BC layer for symfony/config 4.1 and older + $node = $treeBuilder->root('providers'); + } + $requirements = [ 'aws' => [], 'ironmq' => ['token', 'project_id'], @@ -126,9 +137,14 @@ private function getProvidersNode() private function getQueuesNode() { - $treeBuilder = new TreeBuilder(); - $node = $treeBuilder->root('queues'); - + $treeBuilder = new TreeBuilder('queues'); + if (\method_exists($treeBuilder, 'getRootNode')) { + $node = $treeBuilder->getRootNode(); + } else { + // BC layer for symfony/config 4.1 and older + $node = $treeBuilder->root('queues'); + } + $node ->requiresAtLeastOneElement() ->useAttributeAsKey('name') @@ -213,9 +229,14 @@ private function getQueuesNode() private function getSubscribersNode() { - $treeBuilder = new TreeBuilder(); - $node = $treeBuilder->root('subscribers'); - + $treeBuilder = new TreeBuilder('subscribers'); + if (\method_exists($treeBuilder, 'getRootNode')) { + $node = $treeBuilder->getRootNode(); + } else { + // BC layer for symfony/config 4.1 and older + $node = $treeBuilder->root('subscribers'); + } + $node ->prototype('array') ->children()