-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[OptionsResolver] Options not provided by user triggers deprecation #28848
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
Comments
i confused So no real issue so far, but maybe it needs special API like |
I agree, but this behavior is expected also for ppls who use a deprecated option during a lazy evaluation or normalization of another option. In those cases, they should always notice the deprecation message (even, if no value is provided). Tomorrow I'll take a look, |
See #28860 that includes a patch IMHO |
See the proposal to solve it #28878 |
@ro0NL if you have a lazy default value using the value of another deprecated option, you need to be warned, to know you need to migrate your callable (but there should be a way to opt-out of the deprecation to be able to write a BC layer) |
…s used (yceruto) This PR was merged into the 4.2-dev branch. Discussion ---------- [OptionsResolver] Trigger deprecation only if the option is used | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #28848 | License | MIT | Doc PR | symfony/symfony-docs#10496 It's true that showing a deprecation message when the option is not used is a bit annoying and it would be heavy to get rid of it. Now, a deprecated option is triggered only when it's provided by the user or each time is being called from a lazy evaluation (except for deprecations based on the value, they're triggered only when provided by the user). Commits ------- 1af23c9 [OptionsResolver] Trigger deprecation only if the option is used
This PR was merged into the 4.2-dev branch. Discussion ---------- [Form] Deprecate TimezoneType regions option | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | yes | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #28848 | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> I know i've added this option myself in 4.1, but given my recent development for #28624 i realized it's an opinionated feaure, which can/should be solved on user-side (`choice_filter/choice_loader` and/or `group_by`). - blocks translations as we dont have them (see #28831) - blocks possibility of switching to Intl zones which doesnt really have this filter feature (see #28836) ~While at it, i solved a few issues with `OptionsResolver` that is able to deprecate options as of 4.2 also.~ Fixed in #28878 - when resolved trigger the deprecation - allow to opt-out from triggering the deprecation - dont trigger deprecation for default values (only given ones) Commits ------- 5cb532d [Form] Deprecate TimezoneType regions option
Description
Since 4.2 OptionsResolver can deprecate options, however the deprecation is triggered from
offsetGet()
symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php
Line 943 in 9bec1fc
Im not sure about this, it causes the deprecation to trigger without even being provided by the user (i.e. when accessing the default value). Shouldnt it be moved to
resolve()
instead?ref #27277 cc @yceruto
The text was updated successfully, but these errors were encountered: