Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromyceruto:advanced_option_deprecation
Oct 10, 2018

Conversation

@yceruto
Copy link
Member

@ycerutoyceruto commentedOct 5, 2018
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#28721 (comment)
LicenseMIT
Doc PRsymfony/symfony-docs#10439

As spotted here#28721, we sometimes need more advanced cases, where the deprecation of the value depends on another option:

$resolver->setDeprecated('date_format',function (Options$options,$dateFormat) {if (null !==$options['date_format'] &&'single_text' ===$options['widget']) {returnsprintf('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?

Copy link
Contributor

@ogizanagiogizanagi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

👍

@xabbuh
Copy link
Member

We're in time to change the arguments position (Options $options, $value) to be consistent with other closure signatures.

Yes, let's do that. Otherwise, it will become hard to remember when arguments are passed in which order.

ogizanagi and yceruto reacted with thumbs up emoji

@ycerutoycerutoforce-pushed theadvanced_option_deprecation branch 2 times, most recently fromdb8d2b4 to2d531b3CompareOctober 5, 2018 16:40
@nicolas-grekasnicolas-grekas added this to thenext milestoneOct 5, 2018
@ycerutoycerutoforce-pushed theadvanced_option_deprecation branch fromc903fdb to21b9aa3CompareOctober 5, 2018 17:47
Copy link
Member

@xabbuhxabbuh left a 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

@yceruto
Copy link
MemberAuthor

@xabbuh comments addressed.

I'm preparing the doc PR right now.

xabbuh reacted with thumbs up emoji

Copy link
Member

@javiereguiluzjaviereguiluz left a 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!

@fabpotfabpotforce-pushed theadvanced_option_deprecation branch from532b6bd to2936051CompareOctober 10, 2018 09:26
@fabpot
Copy link
Member

Thank you@yceruto.

@fabpotfabpot merged commit2936051 intosymfony:masterOct 10, 2018
fabpot added a commit that referenced this pull requestOct 10, 2018
…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#10439As 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
@ycerutoyceruto deleted the advanced_option_deprecation branchOctober 10, 2018 13:54
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestOct 12, 2018
…re deprecation func (yceruto)This PR was merged into the master branch.Discussion----------[OptionsResolver] Documenting Options argument for closure deprecation funcSeesymfony/symfony#28738Commits-------abb5189 Documenting Options argument for closure deprecation func
@nicolas-grekasnicolas-grekas modified the milestones:next,4.2Nov 1, 2018
This was referencedNov 3, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@javiereguiluzjaviereguiluzjaviereguiluz approved these changes

@xabbuhxabbuhxabbuh approved these changes

+1 more reviewer

@ogizanagiogizanagiogizanagi approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.2

Development

Successfully merging this pull request may close these issues.

7 participants

@yceruto@xabbuh@fabpot@javiereguiluz@ogizanagi@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp