From 7588970d84c1604b98743588ba9020f6bddf6303 Mon Sep 17 00:00:00 2001 From: Gregor Nathanael Meyer Date: Thu, 28 Jul 2022 13:49:50 +0200 Subject: [PATCH] Remove deprecation notice in PHP 8.1 (#357) Adds a `TreeBuilder` return type --- DependencyInjection/Configuration.php | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index db809e5..668b392 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -18,18 +18,9 @@ class Configuration implements ConfigurationInterface /** * {@inheritDoc} */ - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { - $treeBuilder = new TreeBuilder('lexik_form_filter'); - - if (\method_exists($treeBuilder, 'getRootNode')) { - $rootNode = $treeBuilder->getRootNode(); - } else { - // BC layer for symfony/config 4.1 and older - $rootNode = $treeBuilder->root('lexik_form_filter'); - } - - $rootNode + return (new TreeBuilder('lexik_form_filter'))->getRootNode() ->children() ->arrayNode('listeners') ->addDefaultsIfNotSet() @@ -67,8 +58,7 @@ public function getConfigTreeBuilder() ->info('Encoding for case insensitive LIKE comparisons.') ->defaultNull() ->end() - ->end(); - - return $treeBuilder; + ->end() + ->end(); } }