Skip to content

Commit 06ab255

Browse files
Jean-Berunicolas-grekas
authored andcommitted
[FrameworkBundle] Deprecate not setting some options (uid, validation)
1 parent 3b92f65 commit 06ab255

28 files changed

+57
-12
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ CHANGELOG
1717
* Deprecate not setting the `framework.session.cookie_secure` config option; it will default to `auto` in 7.0
1818
* Deprecate not setting the `framework.session.cookie_samesite` config option; it will default to `lax` in 7.0
1919
* Deprecate not setting the `framework.session.handler_id` config option; it will default to `session.handler.native_file` when `framework.session.save_path` is set or `null` otherwise in 7.0
20+
* Deprecate not setting the `framework.uid.default_uuid_version` config option; it will default to `7` in 7.0
21+
* Deprecate not setting the `framework.uid.time_based_uuid_version` config option; it will default to `7` in 7.0
22+
* Deprecate not setting the `framework.validation.email_validation_mode` config option; it will default to `html5` in 7.0
2023

2124
6.3
2225
---

DependencyInjection/Configuration.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,15 @@ private function addTranslatorSection(ArrayNodeDefinition $rootNode, callable $e
10181018
private function addValidationSection(ArrayNodeDefinition $rootNode, callable $enableIfStandalone): void
10191019
{
10201020
$rootNode
1021+
->validate()
1022+
->always(function ($v) {
1023+
if ($v['validation']['enabled'] && !\array_key_exists('email_validation_mode', $v['validation'])) {
1024+
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.');
1025+
}
1026+
1027+
return $v;
1028+
})
1029+
->end()
10211030
->children()
10221031
->arrayNode('validation')
10231032
->info('validation configuration')
@@ -2350,14 +2359,30 @@ private function addRateLimiterSection(ArrayNodeDefinition $rootNode, callable $
23502359
private function addUidSection(ArrayNodeDefinition $rootNode, callable $enableIfStandalone): void
23512360
{
23522361
$rootNode
2362+
->validate()
2363+
->always(function ($v) {
2364+
if ($v['uid']['enabled']) {
2365+
if (!\array_key_exists('default_uuid_version', $v['uid'])) {
2366+
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.uid.default_uuid_version" config option is deprecated. It will default to "7" in 7.0.');
2367+
}
2368+
2369+
if (!\array_key_exists('time_based_uuid_version', $v['uid'])) {
2370+
trigger_deprecation('symfony/framework-bundle', '6.4', 'Not setting the "framework.uid.time_based_uuid_version" config option is deprecated. It will default to "7" in 7.0.');
2371+
}
2372+
}
2373+
2374+
$v['uid'] += ['default_uuid_version' => 6, 'time_based_uuid_version' => 6];
2375+
2376+
return $v;
2377+
})
2378+
->end()
23532379
->children()
23542380
->arrayNode('uid')
23552381
->info('Uid configuration')
23562382
->{$enableIfStandalone('symfony/uid', UuidFactory::class)}()
23572383
->addDefaultsIfNotSet()
23582384
->children()
23592385
->enumNode('default_uuid_version')
2360-
->defaultValue(6)
23612386
->values([7, 6, 4, 1])
23622387
->end()
23632388
->enumNode('name_based_uuid_version')
@@ -2368,7 +2393,6 @@ private function addUidSection(ArrayNodeDefinition $rootNode, callable $enableIf
23682393
->cannotBeEmpty()
23692394
->end()
23702395
->enumNode('time_based_uuid_version')
2371-
->defaultValue(6)
23722396
->values([7, 6, 1])
23732397
->end()
23742398
->scalarNode('time_based_uuid_node')

Tests/DependencyInjection/Fixtures/php/full.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
],
5959
'validation' => [
6060
'enabled' => true,
61+
'email_validation_mode' => 'html5',
6162
],
6263
'annotations' => false,
6364
'serializer' => [

Tests/DependencyInjection/Fixtures/php/validation_annotations.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
'validation' => [
1010
'enabled' => true,
1111
'enable_annotations' => true,
12+
'email_validation_mode' => 'html5',
1213
],
1314
]);
1415

Tests/DependencyInjection/Fixtures/php/validation_auto_mapping.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
'php_errors' => ['log' => true],
88
'property_info' => ['enabled' => true],
99
'validation' => [
10+
'email_validation_mode' => 'html5',
1011
'auto_mapping' => [
1112
'App\\' => ['foo', 'bar'],
1213
'Symfony\\' => ['a', 'b'],

Tests/DependencyInjection/Fixtures/php/validation_legacy_annotations.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
'validation' => [
1212
'enabled' => true,
1313
'enable_annotations' => true,
14+
'email_validation_mode' => 'html5',
1415
],
1516
]);
1617

Tests/DependencyInjection/Fixtures/php/validation_mapping.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
'handle_all_throwables' => true,
77
'php_errors' => ['log' => true],
88
'validation' => [
9+
'email_validation_mode' => 'html5',
910
'mapping' => [
1011
'paths' => [
1112
'%kernel.project_dir%/Fixtures/TestBundle/Resources/config/validation_mapping/files',

Tests/DependencyInjection/Fixtures/php/validation_multiple_static_methods.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
'secret' => 's3cr3t',
99
'validation' => [
1010
'enabled' => true,
11+
'email_validation_mode' => 'html5',
1112
'static_method' => ['loadFoo', 'loadBar'],
1213
],
1314
]);

Tests/DependencyInjection/Fixtures/php/validation_no_static_method.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
'secret' => 's3cr3t',
99
'validation' => [
1010
'enabled' => true,
11+
'email_validation_mode' => 'html5',
1112
'static_method' => false,
1213
],
1314
]);

Tests/DependencyInjection/Fixtures/php/validation_translation_domain.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
'handle_all_throwables' => true,
77
'php_errors' => ['log' => true],
88
'validation' => [
9+
'email_validation_mode' => 'html5',
910
'translation_domain' => 'messages',
1011
],
1112
]);

0 commit comments

Comments
 (0)