-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Config] Allow scalar configuration in PHP Configuration #46328
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to do this only when the node actually has a beforeNormalization? Unless I missed something, right now this will always generate the adaptative code while it might not be needed when beforeNormalization isn't defined.
src/Symfony/Component/Config/Builder/ConfigBuilderGenerator.php
Outdated
Show resolved
Hide resolved
...der/Fixtures/ScalarNormalizedTypes/Symfony/Config/ScalarNormalizedTypes/ListObjectConfig.php
Outdated
Show resolved
Hide resolved
@nicolas-grekas As far as I can tell there's no way to currently know if there are any |
Let's do it by reflection then: that's within the same package, that's fine. |
66a8969
to
be1071b
Compare
@nicolas-grekas The adaptive code is now conditionally generated depending on whether there are normalization closures set or not. I added a new method to the |
src/Symfony/Component/Config/Tests/Builder/Fixtures/ScalarNormalizedTypes.php
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good one, thank you!
9d16892
to
2d81a3a
Compare
Thank you @HypeMC. |
And thank you @jderusse also! |
I've merged this up into 6.0 but there is a failing test:
Could you please have a look and send a fix? 🙏 |
I'd be also happy to let you merge 6.0 into 6.1 if you're up to 😬 (you can do it on your fork and let me know the commit hash here.) |
@nicolas-grekas Sure, I'll take a look. |
This PR was merged into the 6.0 branch. Discussion ---------- [Config] Fix PHP Configuration type hints & tests | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #46328 (comment) | License | MIT | Doc PR | - Followup to #46328 Commits ------- 9d38089 [Config] Fix PHP Configuration type hints & tests
|
Great thank you so much! Now into 6.1. |
…russe) This PR was merged into the 6.2 branch. Discussion ---------- [Config] Use better typehint in PHP Configuration | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - This PR now followup #46328 to replace the generic `mixed` type-hint by type inferred from normalizations (ie, if a config use `ifString`, when now that the normalization works only for string, these `mixed` can safely be replaced by `string`) Commits ------- 0e590dc Allow scalar configuration in PHP Configuration
Fixes passing scalar values to array nodes that have a
beforeNormalization
hook, eg:can be shortened thanks to a
beforeNormalization
hook:I've used some of the code from #44166 by @jderusse. Since his PR is a feature it can't go on 5.4, but it still helped a lot.