From 801e523c06f828b3ba96813fc8ef3165865c0743 Mon Sep 17 00:00:00 2001 From: Dmitrii Date: Wed, 19 Dec 2018 17:21:29 +0200 Subject: [PATCH] Fix root node deprecation in symfony/config > 4.1 (#54) --- DependencyInjection/Configuration.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 0a7c3ae..e7245ed 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -13,8 +13,14 @@ class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder(); - $rootNode = $treeBuilder->root('bm_backup_manager'); + if (method_exists(TreeBuilder::class, 'getRootNode')) { + $treeBuilder = new TreeBuilder('bm_backup_manager'); + $rootNode = $treeBuilder->getRootNode(); + } else { + // BC layer for symfony/config 4.1 and older + $treeBuilder = new TreeBuilder(); + $rootNode = $treeBuilder->root('bm_backup_manager'); + } $rootNode ->children()