Skip to content
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

[OptionsResolver] Trigger deprecation only if the option is used #28878

Merged
merged 1 commit into from Oct 24, 2018

Conversation

yceruto
Copy link
Member

@yceruto yceruto commented Oct 15, 2018

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).

@yceruto
Copy link
Member Author

yceruto commented Oct 15, 2018

There is still a desicion to make here to complete this patch:

#28848 (comment) ... (but there should be a way to opt-out of the deprecation to be able to write a BC layer)

#28860 (comment) offsetGet($option/*, bool $triggerDeprecation = true*/) seems fine? That be the easiest :) It's not needed yet, but surely sooner or later, for lib owners a must (so we should ship it as a feature)

See example in https://github.com/symfony/symfony/pull/28860/files#diff-c6198934d4f35bc102ff362d40b71285R40

WDYT about the @ro0NL's idea? thoughts?

@yceruto yceruto force-pushed the trigger_deprecation branch 3 times, most recently from d57f826 to 06ca456 Compare October 16, 2018 12:17
@yceruto yceruto force-pushed the trigger_deprecation branch 2 times, most recently from aa247e2 to db8a3db Compare October 16, 2018 20:24
@nicolas-grekas nicolas-grekas added this to the 4.2 milestone Oct 17, 2018
@yceruto yceruto force-pushed the trigger_deprecation branch 3 times, most recently from 1b1334f to 44870ef Compare October 19, 2018 12:31
@nicolas-grekas
Copy link
Member

offsetGet($option/, bool $triggerDeprecation = true/)

looks like this is the way to go, isn't it?

@yceruto
Copy link
Member Author

yceruto commented Oct 21, 2018

It should be ready now.

@fabpot
Copy link
Member

fabpot commented Oct 24, 2018

Thank you @yceruto.

@fabpot fabpot merged commit 1af23c9 into symfony:master Oct 24, 2018
fabpot added a commit that referenced this pull request Oct 24, 2018
…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
@yceruto yceruto deleted the trigger_deprecation branch October 24, 2018 10:52
fabpot added a commit that referenced this pull request Oct 25, 2018
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
xabbuh added a commit to symfony/symfony-docs that referenced this pull request Nov 11, 2018
…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
nicolas-grekas added a commit that referenced this pull request Jun 9, 2019
…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()
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Jun 11, 2019
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants