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

Appearance settings

[OptionsResolver] Implemented policies for treating unknown/missing options #10574

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

Closed
wants to merge 4 commits into from

Conversation

webmozart
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #7979, replaces #9754
License MIT
Doc PR symfony/symfony-docs#3731

/**
* Throw an exception if a required option is missing in {@link resolve()}.
*/
const FORBID_MISSING = 32;
Copy link
Contributor

Choose a reason for hiding this comment

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

16 missing?

Copy link
Member

Choose a reason for hiding this comment

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

And what about 8?

Copy link
Contributor

Choose a reason for hiding this comment

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

^^

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left them out by intention to allow further "UNKNOWN" values to be added (if needed).

Copy link
Contributor

Choose a reason for hiding this comment

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

You can also add them at the end with higher values if needed

Either we need to check all flags for mutual exclusivity, or none. Since
checking all flags is expensive, I'm removing this check altogether.
@webmozart
Copy link
Contributor Author

Updated.

@Tobion
Copy link
Contributor

Tobion commented Mar 30, 2014

For completness one could also add FORBID_INVALID, INGORE_INVALID and REMOVE_INVALID behavior for type and value checks.

@Tobion
Copy link
Contributor

Tobion commented Mar 30, 2014

Btw; I think the exceptions are defined wrong because they don't respect the meaning of runtime vs logic exception.

  • OptionDefinitionException is obviously a logic exception because it happens with a code problem and should extend \InvalidArgumentException.
  • InvalidOptionsException is a runtimeexception and should extend \UnexpectedValueException
  • MissingOptionsException is also runtimeexception and should extend \UnexpectedValueException

Created #10585 as its unrelated

@webmozart
Copy link
Contributor Author

@Tobion I thought about FORBID_INVALID, INGORE_INVALID and REMOVE_INVALID, but I don't really see a use case.

Thanks for opening that issue!

@Tobion
Copy link
Contributor

Tobion commented Mar 30, 2014

👍

@webmozart webmozart closed this Mar 31, 2014
@webmozart webmozart deleted the issue9754 branch March 31, 2014 10:00
@iamluc
Copy link
Contributor

iamluc commented Mar 31, 2014

@webmozart are you going to open a new PR on this ?

@webmozart
Copy link
Contributor Author

Oops, I didn't realize I closed this one, I thought it was already merged. Here's the new one: #10616

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.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.