From 58716df119a8d353dec36b241c1be5d735e5ae96 Mon Sep 17 00:00:00 2001 From: Sebastian Sellmeier Date: Sun, 22 Dec 2019 02:21:58 +0000 Subject: [PATCH] Fix method change (#12) * Fix method change to support SF 3.4 and 4.* --- src/DependencyInjection/Configuration.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 723f435..042e5f0 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -7,23 +7,28 @@ class Configuration implements ConfigurationInterface { + protected const ROOT_NODE = 'inwx_api'; + public function getConfigTreeBuilder(): TreeBuilder { - $treeBuilder = new TreeBuilder('inwx_api'); + $treeBuilder = new TreeBuilder(self::ROOT_NODE); + + $root = \method_exists($treeBuilder, 'getRootNode') ? + $treeBuilder->getRootNode() : + $treeBuilder->root(self::ROOT_NODE); - $treeBuilder - ->getRootNode() + $root ->children() ->booleanNode('debug') ->defaultFalse() ->end() ->enumNode('environment') ->values( - array( - 'production', - 'development', - ) - ) + array( + 'production', + 'development', + ) + ) ->defaultValue('development') ->end() ->booleanNode('json')