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

[Config] Config builders should accept booleans for array nodes that can be enabled or disabled#61858

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:7.4fromnicolas-grekas:config-pump
Sep 29, 2025

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedSep 26, 2025
edited
Loading

QA
Branch?7.4
Bug fix?yes
New feature?no
Deprecations?no
Issues-
LicenseMIT

Continuing my journey on the config component, after#51273

That could be considered as a bugfix, but it's not worth fixing on lower branches because nobody is using this missing capability - by definition.

So: this allows doing eg->lock(false) to disable locks, as expected when the node definition has->treatFalseLike(['enabled' => false])

Note that I didn't turn->treatNullLike(['enabled' => true]) into acceptingnull as I don't see the point of allowing->lock(null) when one can use->lock(true).

$allowedTypes =$this->allowedTypes ??$this->normalization->declaredTypes;
foreach ([$this->trueEquivalent,$this->falseEquivalent]as$equivalent) {
if (\is_array($equivalent) &&$equivalent) {
$allowedTypes[] = ExprBuilder::TYPE_BOOL;
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this is the fix
the rest is code simplifications

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

👍🏽

->beforeNormalization()
->ifArray()
->then(staticfunction ($v) {
$v += ['enabled' =>true];
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

we can rely on canBeEnabled/Disabled to set this default, but acceptAndWrap should then be moved earlier to have a proper ordering of beforeNormalization calls (adding [enabled => true] to wrapped strings)

$allowedTypes =$this->allowedTypes ??$this->normalization->declaredTypes;
foreach ([$this->trueEquivalent,$this->falseEquivalent]as$equivalent) {
if (\is_array($equivalent) &&$equivalent) {
$allowedTypes[] = ExprBuilder::TYPE_BOOL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

👍🏽

Copy link
Member

@GromNaNGromNaN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can we add new tests to validate this new behavior?

@nicolas-grekas
Copy link
MemberAuthor

no need for new tests, the existing updated one covers this

Copy link
Member

@GromNaNGromNaN left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Indeed, the generated code has changed and this change is tested. Thank you for clarifying.

@fabpot
Copy link
Member

Thank you@nicolas-grekas.

@fabpotfabpot merged commit37029cc intosymfony:7.4Sep 29, 2025
10 of 12 checks passed
@nicolas-grekasnicolas-grekas deleted the config-pump branchSeptember 29, 2025 06:30
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@GromNaNGromNaNGromNaN approved these changes

@SpomkySpomkySpomky approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

7.4

Development

Successfully merging this pull request may close these issues.

5 participants

@nicolas-grekas@fabpot@GromNaN@Spomky@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp