From 710d389495bfdbb2c7de8c8438e38625f83a0077 Mon Sep 17 00:00:00 2001 From: Daniel Stancu Date: Sun, 20 Oct 2019 02:52:42 +0300 Subject: [PATCH] Fix deprecated TreeBuilder::root()" method --- src/DependencyInjection/Configuration.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 50fb80e..813a8fc 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -23,10 +23,14 @@ class Configuration implements ConfigurationInterface /** * @return TreeBuilder */ - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { - $treeBuilder = new TreeBuilder(); - $rootNode = $treeBuilder->root(NetopiaMobilPayBundle::ALIAS); + if (Kernel::VERSION_ID >= 40200) { + $builder = new TreeBuilder(NetopiaMobilPayBundle::ALIAS); + } else { + $builder = new TreeBuilder(); + } + $rootNode = \method_exists($builder, 'getRootNode') ? $builder->getRootNode() : $builder->root(NetopiaMobilPayBundle::ALIAS); $rootNode ->children() @@ -35,6 +39,6 @@ public function getConfigTreeBuilder() ->scalarNode('private_key')->defaultNull()->end() ->scalarNode('signature')->cannotBeEmpty()->defaultValue('XXXX-XXXX-XXXX-XXXX-XXXX')->end(); - return $treeBuilder; + return $builder; } }