-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Config] Allow using defaultNull() on BooleanNodeDefinition
#58490
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
Conversation
69acbf9 to
71bace0
Compare
9f8f8f1 to
2948789
Compare
|
Do we need some changes in config builders, like done in #58428? |
2948789 to
06d0e19
Compare
06d0e19 to
6aad690
Compare
|
I don't think so, |
|
Thank you @alexandre-daubois. |
This PR was merged into the 5.4 branch. Discussion ---------- Add BC promise rules for constructors As spotted in symfony/symfony#58490, following symfony/symfony#58490 (comment) Commits ------- 72d416c Add BC promise rules for constructors
|
This change apparently broke MonologBundle's test suite, see https://github.com/symfony/monolog-bundle/actions/runs/11651735613/job/32442060641#step:8:25 for instance. Can you please have a look, @alexandre-daubois? |
|
Yes 👍 |
This PR was merged into the 3.x-dev branch. Discussion ---------- Fix test with `symfony/config:^7.2` Following symfony/symfony#58490 (comment). Until the Symfony PR, null wasn't supported in boolean nodes and defaulted to true. Commits ------- 3fd3da1 Fix test with `symfony/config:^7.2`
After this comment. Currently,
defaultNull()on BooleanNode doesn't work well: the value always casts totrue. This PR allows to make the node nullable by callingdefaultNull()ordefaultValue(null).Given the following configuration on a brand new project (with
composer require symfony/form symfony/csrf-protection):Dumping
$config['form']['csrf_protection']['enabled']reveals theenabledoption is casted totruewhen set tonullin the config. The following condition is never true:symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Line 755 in b61db2f
With this PR, the
enabledoption keeps thenullvalue when defining the node as it already is in the code:symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Line 214 in b61db2f