Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbd0538d

Browse files
committed
[FrameworkBundle] Fix BC break about enable_annotations in validation and serializer configuration
1 parent61023a7 commitbd0538d

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,27 +1026,30 @@ private function addValidationSection(ArrayNodeDefinition $rootNode, callable $e
10261026
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.');
10271027
}
10281028

1029-
if (isset($v['enable_annotations'])) {
1030-
trigger_deprecation('symfony/framework-bundle','6.4','Option "enable_annotations" at "framework.validation" is deprecated. Use the "enable_attributes" option instead.');
1031-
1032-
if (!isset($v['enable_attributes'])) {
1033-
$v['enable_attributes'] =$v['enable_annotations'];
1034-
}else {
1035-
thrownewLogicException('The "enable_annotations" and "enable_attributes" options at path "framework.validation" must not be both set. Only the "enable_attributes" option must be used.');
1036-
}
1037-
}
1038-
10391029
return$v;
10401030
})
10411031
->end()
10421032
->children()
10431033
->arrayNode('validation')
1034+
->beforeNormalization()
1035+
->ifTrue(fn ($v) =>isset($v['enable_annotations']))
1036+
->then(function ($v) {
1037+
trigger_deprecation('symfony/framework-bundle','6.4','Option "enable_annotations" at "framework.validation" is deprecated. Use the "enable_attributes" option instead.');
1038+
1039+
if (isset($v['enable_attributes'])) {
1040+
thrownewLogicException('The "enable_annotations" and "enable_attributes" options at path "framework.validation" must not be both set. Only the "enable_attributes" option must be used.');
1041+
}
1042+
$v['enable_attributes'] =$v['enable_annotations'];
1043+
1044+
return$v;
1045+
})
1046+
->end()
10441047
->info('validation configuration')
10451048
->{$enableIfStandalone('symfony/validator', Validation::class)}()
10461049
->children()
10471050
->scalarNode('cache')->end()
10481051
->booleanNode('enable_annotations')->end()
1049-
->booleanNode('enable_attributes')->{!class_exists(FullStack::class) ?'defaultTrue' :'defaultFalse'}()->end()
1052+
->booleanNode('enable_attributes')->{class_exists(FullStack::class) ?'defaultFalse' :'defaultTrue'}()->end()
10501053
->arrayNode('static_method')
10511054
->defaultValue(['loadValidatorMetadata'])
10521055
->prototype('scalar')->end()
@@ -1152,25 +1155,24 @@ private function addSerializerSection(ArrayNodeDefinition $rootNode, callable $e
11521155
$rootNode
11531156
->children()
11541157
->arrayNode('serializer')
1155-
->validate()
1156-
->always(function ($v){
1157-
if (isset($v['enable_annotations'])) {
1158+
->beforeNormalization()
1159+
->ifTrue(fn ($v)=>isset($v['enable_annotations']))
1160+
->then(function ($v) {
11581161
trigger_deprecation('symfony/framework-bundle','6.4','Option "enable_annotations" at "framework.serializer" is deprecated. Use the "enable_attributes" option instead.');
11591162

1160-
if (!isset($v['enable_attributes'])) {
1161-
$v['enable_attributes'] =$v['enable_annotations'];
1162-
}else {
1163+
if (isset($v['enable_attributes'])) {
11631164
thrownewLogicException('The "enable_annotations" and "enable_attributes" options at path "framework.serializer" must not be both set. Only the "enable_attributes" option must be used.');
11641165
}
1165-
}
1166+
$v['enable_attributes'] =$v['enable_annotations'];
11661167

1167-
return$v;
1168-
})->end()
1168+
return$v;
1169+
})
1170+
->end()
11691171
->info('serializer configuration')
11701172
->{$enableIfStandalone('symfony/serializer', Serializer::class)}()
11711173
->children()
11721174
->booleanNode('enable_annotations')->end()
1173-
->booleanNode('enable_attributes')->{!class_exists(FullStack::class) ?'defaultTrue' :'defaultFalse'}()->end()
1175+
->booleanNode('enable_attributes')->{class_exists(FullStack::class) ?'defaultFalse' :'defaultTrue'}()->end()
11741176
->scalarNode('name_converter')->end()
11751177
->scalarNode('circular_reference_handler')->end()
11761178
->scalarNode('max_depth_handler')->end()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp