From 5e6b8b1bdae377596276a3f03a5a6cfc2a9286c6 Mon Sep 17 00:00:00 2001 From: Doqnach Date: Tue, 17 Dec 2019 23:40:23 +0100 Subject: [PATCH] Fixed TreeBuilder::root() symfony 4.3 deprecation (#21) * Fixed symfony 4.2 deprecation The "Symfony\Component\Config\Definition\Builder\TreeBuilder::root()" method called for the "qp_woohoolabs_yin" configuration is deprecated since Symfony 4.3, pass the root name to the constructor instead * [patch-1] Use BC layer for deprecation in symfony/config see https://github.com/symfony/maker-bundle/pull/324 and https://github.com/doctrine/DoctrineBundle/pull/853 Remove the BC layer when bump to next major version. --- src/DependencyInjection/Configuration.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index ac2f600..84d5233 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -14,8 +14,14 @@ class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder(); - $rootNode = $treeBuilder->root('qp_woohoolabs_yin'); + $treeBuilder = new TreeBuilder('qp_woohoolabs_yin'); + + if (\method_exists($treeBuilder, 'getRootNode')) { + $rootNode = $treeBuilder->getRootNode(); + } else { + // BC layer for symfony/config 4.1 and older + $rootNode = $treeBuilder->root('qp_woohoolabs_yin'); + } $rootNode ->children()