Skip to content

[FrameworkBundle] Simplify the configuration class #58450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode): void
->end()
->end()
->arrayNode('supports')
->beforeNormalization()
->ifString()
->then(fn ($v) => [$v])
->end()
->beforeNormalization()->castToArray()->end()
->prototype('scalar')
->cannotBeEmpty()
->validate()
Expand Down Expand Up @@ -535,20 +532,14 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode): void
->example('is_fully_authenticated() and is_granted(\'ROLE_JOURNALIST\') and subject.getTitle() == \'My first article\'')
->end()
->arrayNode('from')
->beforeNormalization()
->ifString()
->then(fn ($v) => [$v])
->end()
->beforeNormalization()->castToArray()->end()
->requiresAtLeastOneElement()
->prototype('scalar')
->cannotBeEmpty()
->end()
->end()
->arrayNode('to')
->beforeNormalization()
->ifString()
->then(fn ($v) => [$v])
->end()
->beforeNormalization()->castToArray()->end()
->requiresAtLeastOneElement()
->prototype('scalar')
->cannotBeEmpty()
Expand Down Expand Up @@ -933,7 +924,7 @@ private function addTranslatorSection(ArrayNodeDefinition $rootNode, callable $e
->children()
->arrayNode('fallbacks')
->info('Defaults to the value of "default_locale".')
->beforeNormalization()->ifString()->then(fn ($v) => [$v])->end()
->beforeNormalization()->castToArray()->end()
->prototype('scalar')->end()
->defaultValue([])
->end()
Expand Down Expand Up @@ -1436,7 +1427,7 @@ private function addLockSection(ArrayNodeDefinition $rootNode, callable $enableI
->end()
->prototype('array')
->performNoDeepMerging()
->beforeNormalization()->ifString()->then(fn ($v) => [$v])->end()
->beforeNormalization()->castToArray()->end()
->prototype('scalar')->end()
->end()
->end()
Expand Down Expand Up @@ -2226,7 +2217,7 @@ private function addNotifierSection(ArrayNodeDefinition $rootNode, callable $ena
->arrayNode('channel_policy')
->useAttributeAsKey('name')
->prototype('array')
->beforeNormalization()->ifString()->then(fn ($v) => [$v])->end()
->beforeNormalization()->castToArray()->end()
->prototype('scalar')->end()
->end()
->end()
Expand Down Expand Up @@ -2442,18 +2433,12 @@ private function addHtmlSanitizerSection(ArrayNodeDefinition $rootNode, callable
->end()
->arrayNode('block_elements')
->info('Configures elements as blocked. Blocked elements are elements the sanitizer should remove from the input, but retain their children.')
->beforeNormalization()
->ifString()
->then(fn (string $n): array => (array) $n)
->end()
->beforeNormalization()->castToArray()->end()
->scalarPrototype()->end()
->end()
->arrayNode('drop_elements')
->info('Configures elements as dropped. Dropped elements are elements the sanitizer should remove from the input, including their children.')
->beforeNormalization()
->ifString()
->then(fn (string $n): array => (array) $n)
->end()
->beforeNormalization()->castToArray()->end()
->scalarPrototype()->end()
->end()
->arrayNode('allow_attributes')
Expand Down