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

Commitfddd33e

Browse files
minor#58450 [FrameworkBundle] Simplify the configuration class (javiereguiluz)
This PR was squashed before being merged into the 7.2 branch.Discussion----------[FrameworkBundle] Simplify the configuration class| Q | A| ------------- | ---| Branch? | 7.2| Bug fix? | no| New feature? | no| Deprecations? | no| Issues | -| License | MITSpotted while documenting#58161.Commits-------429fc32 [FrameworkBundle] Simplify the configuration class
2 parents06d1b76 +429fc32 commitfddd33e

File tree

1 file changed

+8
-23
lines changed

1 file changed

+8
-23
lines changed

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

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode): void
403403
->end()
404404
->end()
405405
->arrayNode('supports')
406-
->beforeNormalization()
407-
->ifString()
408-
->then(fn ($v) => [$v])
409-
->end()
406+
->beforeNormalization()->castToArray()->end()
410407
->prototype('scalar')
411408
->cannotBeEmpty()
412409
->validate()
@@ -535,20 +532,14 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode): void
535532
->example('is_fully_authenticated() and is_granted(\'ROLE_JOURNALIST\') and subject.getTitle() ==\'My first article\'')
536533
->end()
537534
->arrayNode('from')
538-
->beforeNormalization()
539-
->ifString()
540-
->then(fn ($v) => [$v])
541-
->end()
535+
->beforeNormalization()->castToArray()->end()
542536
->requiresAtLeastOneElement()
543537
->prototype('scalar')
544538
->cannotBeEmpty()
545539
->end()
546540
->end()
547541
->arrayNode('to')
548-
->beforeNormalization()
549-
->ifString()
550-
->then(fn ($v) => [$v])
551-
->end()
542+
->beforeNormalization()->castToArray()->end()
552543
->requiresAtLeastOneElement()
553544
->prototype('scalar')
554545
->cannotBeEmpty()
@@ -933,7 +924,7 @@ private function addTranslatorSection(ArrayNodeDefinition $rootNode, callable $e
933924
->children()
934925
->arrayNode('fallbacks')
935926
->info('Defaults to the value of "default_locale".')
936-
->beforeNormalization()->ifString()->then(fn ($v) => [$v])->end()
927+
->beforeNormalization()->castToArray()->end()
937928
->prototype('scalar')->end()
938929
->defaultValue([])
939930
->end()
@@ -1436,7 +1427,7 @@ private function addLockSection(ArrayNodeDefinition $rootNode, callable $enableI
14361427
->end()
14371428
->prototype('array')
14381429
->performNoDeepMerging()
1439-
->beforeNormalization()->ifString()->then(fn ($v) => [$v])->end()
1430+
->beforeNormalization()->castToArray()->end()
14401431
->prototype('scalar')->end()
14411432
->end()
14421433
->end()
@@ -2226,7 +2217,7 @@ private function addNotifierSection(ArrayNodeDefinition $rootNode, callable $ena
22262217
->arrayNode('channel_policy')
22272218
->useAttributeAsKey('name')
22282219
->prototype('array')
2229-
->beforeNormalization()->ifString()->then(fn ($v) => [$v])->end()
2220+
->beforeNormalization()->castToArray()->end()
22302221
->prototype('scalar')->end()
22312222
->end()
22322223
->end()
@@ -2442,18 +2433,12 @@ private function addHtmlSanitizerSection(ArrayNodeDefinition $rootNode, callable
24422433
->end()
24432434
->arrayNode('block_elements')
24442435
->info('Configures elements as blocked. Blocked elements are elements the sanitizer should remove from the input, but retain their children.')
2445-
->beforeNormalization()
2446-
->ifString()
2447-
->then(fn (string$n):array => (array)$n)
2448-
->end()
2436+
->beforeNormalization()->castToArray()->end()
24492437
->scalarPrototype()->end()
24502438
->end()
24512439
->arrayNode('drop_elements')
24522440
->info('Configures elements as dropped. Dropped elements are elements the sanitizer should remove from the input, including their children.')
2453-
->beforeNormalization()
2454-
->ifString()
2455-
->then(fn (string$n):array => (array)$n)
2456-
->end()
2441+
->beforeNormalization()->castToArray()->end()
24572442
->scalarPrototype()->end()
24582443
->end()
24592444
->arrayNode('allow_attributes')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp