From 1675b4362da8161d1e9f8ab67da2027ed0f51389 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Wed, 28 Feb 2024 11:47:05 +0100 Subject: [PATCH 1/1] Remove unused languages Allow default and class extra keys Cleanup --- DependencyInjection/Configuration.php | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index fa3306c..ffe1d14 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -34,8 +34,8 @@ class Configuration implements ConfigurationInterface { //The bundle default values $defaults = [ 'class' => [ - 'group' => 'Rapsys\\UserBundle\\Entity\\Group', 'civility' => 'Rapsys\\UserBundle\\Entity\\Civility', + 'group' => 'Rapsys\\UserBundle\\Entity\\Group', 'user' => 'Rapsys\\UserBundle\\Entity\\User' ], 'default' => [ @@ -70,9 +70,6 @@ class Configuration implements ConfigurationInterface { ] ], 'translate' => [], - 'languages' => [ - 'en_gb' => 'English' - ], 'contact' => [ 'address' => 'contact@example.com', 'name' => 'John Doe' @@ -152,12 +149,17 @@ class Configuration implements ConfigurationInterface { ->addDefaultsIfNotSet() ->children() ->arrayNode('class') - ->treatNullLike([]) - ->defaultValue($defaults['class']) - ->scalarPrototype()->end() + ->addDefaultsIfNotSet() + ->ignoreExtraKeys() + ->children() + ->scalarNode('civility')->cannotBeEmpty()->defaultValue($defaults['class']['civility'])->end() + ->scalarNode('group')->cannotBeEmpty()->defaultValue($defaults['class']['group'])->end() + ->scalarNode('user')->cannotBeEmpty()->defaultValue($defaults['class']['user'])->end() + ->end() ->end() ->arrayNode('default') ->addDefaultsIfNotSet() + ->ignoreExtraKeys() ->children() ->scalarNode('admin')->cannotBeEmpty()->defaultValue($defaults['default']['admin'])->end() ->scalarNode('civility')->cannotBeEmpty()->defaultValue($defaults['default']['civility'])->end() @@ -244,12 +246,6 @@ class Configuration implements ConfigurationInterface { ->defaultValue($defaults['translate']) ->scalarPrototype()->end() ->end() - #TODO: see if we can't prevent key normalisation with ->normalizeKeys(false) - ->arrayNode('languages') - ->treatNullLike([]) - ->defaultValue($defaults['languages']) - ->scalarPrototype()->end() - ->end() ->arrayNode('contact') ->addDefaultsIfNotSet() ->children() -- 2.41.1