From 1b4835eb4d78c8aa1e46049a3d874ba76bf099ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20W=C3=B3js?= Date: Sun, 22 Sep 2019 13:10:16 +0200 Subject: [PATCH] Fixed deprecated TreeBuilder::root method call in SF 4 --- DependencyInjection/Configuration.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 413033d..3683c20 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -14,8 +14,14 @@ class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder(); - $rootNode = $treeBuilder->root('gregwar_captcha'); + $treeBuilder = new TreeBuilder('gregwar_captcha'); + + if (method_exists($treeBuilder, 'getRootNode')) { + $rootNode = $treeBuilder->getRootNode(); + } else { + // BC for symfony/config <= 4.1 + $rootNode = $treeBuilder->root('gregwar_captcha'); + } $rootNode ->addDefaultsIfNotSet()