-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[OptionsResolver] Trigger deprecation only if the option is used #28878
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
c19026d
to
d52af6c
Compare
There is still a desicion to make here to complete this patch:
See example in https://github.com/symfony/symfony/pull/28860/files#diff-c6198934d4f35bc102ff362d40b71285R40 WDYT about the @ro0NL's idea? thoughts? |
d57f826
to
06ca456
Compare
aa247e2
to
db8a3db
Compare
1b1334f
to
44870ef
Compare
looks like this is the way to go, isn't it? |
It should be ready now. |
src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php
Outdated
Show resolved
Hide resolved
c47fd5f
to
6c191b7
Compare
6c191b7
to
e955dbd
Compare
e955dbd
to
1af23c9
Compare
Thank you @yceruto. |
…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
…on (yceruto) This PR was merged into the master branch. Discussion ---------- [OptionsResolver] Add some notes about trigger deprecation Updates according to symfony/symfony#28878 Commits ------- bb4861b Add some notes about trigger deprecation
…ons::offsetGet() (nicolas-grekas) This PR was submitted for the 4.3 branch but it was merged into the 4.2 branch instead (closes #31950). Discussion ---------- [OptionsResolver] fix adding $triggerDeprecation to Options::offsetGet() | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This has been added by @yceruto in #28878 but it doesn't make sense to me: the interface has no concept if deprecation (`OptionsResolver` has!) Commits ------- adc7e6a [OptionsResolver] fix adding $triggerDeprecation to Options::offsetGet()
…ruto) This PR was squashed before being merged into the 4.2 branch (closes #11704). Discussion ---------- [OptionsResolver] Add note about deprecated options Missing piece related to symfony/symfony#28878 Commits ------- aaac426 [OptionsResolver] Add note about deprecated options
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).