-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[OptionsResolver] Passing Options argument to deprecation closure #28738
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.
👍
Yes, let's do that. Otherwise, it will become hard to remember when arguments are passed in which order. |
db8d2b4
to
2d531b3
Compare
c903fdb
to
21b9aa3
Compare
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.
just two minor suggestions
@xabbuh comments addressed. I'm preparing the doc PR right now. |
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.
Useful feature, nicely developed and fully documented. @yceruto thanks a lot for doing things so nice!
532b6bd
to
2936051
Compare
Thank you @yceruto. |
…ion closure (yceruto) This PR was squashed before being merged into the 4.2-dev branch (closes #28738). Discussion ---------- [OptionsResolver] Passing Options argument to deprecation closure | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #28721 (comment) | License | MIT | Doc PR | symfony/symfony-docs#10439 As spotted here #28721, we sometimes need more advanced cases, where the deprecation of the value depends on another option: ```php $resolver->setDeprecated('date_format', function (Options $options, $dateFormat) { if (null !== $options['date_format'] && 'single_text' === $options['widget']) { return sprintf('Using the "date_format" option of the %s when the "widget" option is set to "single_text" is deprecated since Symfony 4.2.', self::class); } return ''; }); ``` There is still a decision to make: > We're in time to change the arguments position (Options $options, $value) to be consistent with other closure signatures. WDYT? Commits ------- 2936051 [OptionsResolver] Passing Options argument to deprecation closure
…re deprecation func (yceruto) This PR was merged into the master branch. Discussion ---------- [OptionsResolver] Documenting Options argument for closure deprecation func See symfony/symfony#28738 Commits ------- abb5189 Documenting Options argument for closure deprecation func
As spotted here #28721, we sometimes need more advanced cases, where the deprecation of the value depends on another option:
There is still a decision to make:
WDYT?