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] Choose policy on unknown options#9754

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

Conversation

@iamluc
Copy link
Contributor

Hi,

This commit adds the possibility to choose a policy on unknown options :

  • required : like before, throw exception (default to keep BC)
  • remove : remove options and do not throw exception
  • ignore : keep options and do not throw exception
QA
Bug fix?no
New feature?yes
BC breaks?yes
Deprecations?no
Tests pass?yes
Fixed tickets#7979
LicenseMIT
Doc PR

@COil
Copy link
Contributor

👍

Copy link
Member

Choose a reason for hiding this comment

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

please keep them on 1 line

@iamluc
Copy link
ContributorAuthor

Updated according to comments

Copy link
Contributor

Choose a reason for hiding this comment

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

$options is superflu here

@Koc
Copy link
Contributor

Koc commentedDec 13, 2013

Replaces#7985 , fix#7979?

@kbond
Copy link
Member

Yes, this looks great!

@iamluc
Copy link
ContributorAuthor

Fix phpdoc as suggested by pborreli + add public method setUnknownOptionPolicy($unknownOptionPolicy)

@pborreli
Copy link
Contributor

@iamluc you should fix your git username (vieilles instead of iamluc)https://help.github.com/articles/setting-your-username-in-git and fix withgit commit --amend --author "New Author Name <email@address.com>"

@iamluc
Copy link
ContributorAuthor

@pborreli thanks ! done.

@stof
Copy link
Member

I don't think we should have a mutator for this policy: the code instantiating the resolver should control the behavior it expects for unknown options. External code receiceving it to configure default options should not be able to change the policy IMO

@iamluc
Copy link
ContributorAuthor

@stof OK, i will revert this.
Do you prefer that I change the method to private or moving the code back in the constructor ?

@stof
Copy link
Member

@iamluc move it back to the constructor IMO

@webmozart
Copy link
Contributor

I would prefer if this functionality was configurable in theresolve() method, for example through a parameter$flags:

publicfunction resolve(array$options =array(),$flags =0);

Example usage:

$options =$resolver->resolve($usersOptions, OptionsResolverInterface::REMOVE_UNKNOWN);

Copy link
Contributor

Choose a reason for hiding this comment

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

you need to set the third argument (strict) to true, otherwise'1' would go throught but fail later

@iamluc
Copy link
ContributorAuthor

@bschussek PR updated. Is now BC because we changed Interface

Copy link
Contributor

Choose a reason for hiding this comment

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

must be on the same line as the}

@fabpot
Copy link
Member

What is the status of this PR?@webmozart Can you check the latest version of the code?

@webmozart
Copy link
Contributor

Replaced by#10574.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

12 participants

@iamluc@COil@Koc@kbond@pborreli@stof@webmozart@fabpot@cordoval@Tobion@sstok@bmancone

[8]ページ先頭

©2009-2025 Movatter.jp