diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 7d386b543c706..05497c0be7b64 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -1026,27 +1026,30 @@ private function addValidationSection(ArrayNodeDefinition $rootNode, callable $e trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.validation.email_validation_mode" config option is deprecated. It will default to "html5" in 7.0.'); } - if (isset($v['enable_annotations'])) { - trigger_deprecation('symfony/framework-bundle', '6.4', 'Option "enable_annotations" at "framework.validation" is deprecated. Use the "enable_attributes" option instead.'); - - if (!isset($v['enable_attributes'])) { - $v['enable_attributes'] = $v['enable_annotations']; - } else { - throw new LogicException('The "enable_annotations" and "enable_attributes" options at path "framework.validation" must not be both set. Only the "enable_attributes" option must be used.'); - } - } - return $v; }) ->end() ->children() ->arrayNode('validation') + ->beforeNormalization() + ->ifTrue(fn ($v) => isset($v['enable_annotations'])) + ->then(function ($v) { + trigger_deprecation('symfony/framework-bundle', '6.4', 'Option "enable_annotations" at "framework.validation" is deprecated. Use the "enable_attributes" option instead.'); + + if (isset($v['enable_attributes'])) { + throw new LogicException('The "enable_annotations" and "enable_attributes" options at path "framework.validation" must not be both set. Only the "enable_attributes" option must be used.'); + } + $v['enable_attributes'] = $v['enable_annotations']; + + return $v; + }) + ->end() ->info('validation configuration') ->{$enableIfStandalone('symfony/validator', Validation::class)}() ->children() ->scalarNode('cache')->end() ->booleanNode('enable_annotations')->end() - ->booleanNode('enable_attributes')->{!class_exists(FullStack::class) ? 'defaultTrue' : 'defaultFalse'}()->end() + ->booleanNode('enable_attributes')->{class_exists(FullStack::class) ? 'defaultFalse' : 'defaultTrue'}()->end() ->arrayNode('static_method') ->defaultValue(['loadValidatorMetadata']) ->prototype('scalar')->end() @@ -1152,25 +1155,24 @@ private function addSerializerSection(ArrayNodeDefinition $rootNode, callable $e $rootNode ->children() ->arrayNode('serializer') - ->validate() - ->always(function ($v) { - if (isset($v['enable_annotations'])) { + ->beforeNormalization() + ->ifTrue(fn ($v) => isset($v['enable_annotations'])) + ->then(function ($v) { trigger_deprecation('symfony/framework-bundle', '6.4', 'Option "enable_annotations" at "framework.serializer" is deprecated. Use the "enable_attributes" option instead.'); - if (!isset($v['enable_attributes'])) { - $v['enable_attributes'] = $v['enable_annotations']; - } else { + if (isset($v['enable_attributes'])) { throw new LogicException('The "enable_annotations" and "enable_attributes" options at path "framework.serializer" must not be both set. Only the "enable_attributes" option must be used.'); } - } + $v['enable_attributes'] = $v['enable_annotations']; - return $v; - })->end() + return $v; + }) + ->end() ->info('serializer configuration') ->{$enableIfStandalone('symfony/serializer', Serializer::class)}() ->children() ->booleanNode('enable_annotations')->end() - ->booleanNode('enable_attributes')->{!class_exists(FullStack::class) ? 'defaultTrue' : 'defaultFalse'}()->end() + ->booleanNode('enable_attributes')->{class_exists(FullStack::class) ? 'defaultFalse' : 'defaultTrue'}()->end() ->scalarNode('name_converter')->end() ->scalarNode('circular_reference_handler')->end() ->scalarNode('max_depth_handler')->end()
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: