8000 [OptionsResolver] Implemented policies for treating unknown/missing options by webmozart · Pull Request #10616 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

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

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 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[OptionsResolver] Removed flag check
Either we need to check all flags for mutual exclusivity, or none. Since
checking all flags is expensive, I'm removing this check altogether.
  • Loading branch information
webmozart committed Mar 30, 2014
commit 3eb8c476db91fda0748b34026d001832fe1896d3
4 changes: 0 additions & 4 deletions src/Symfony/Component/OptionsResolver/OptionsResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,6 @@ public function resolve(array $options = array(), $flags = 0)
$flags |= self::FORBID_MISSING;
}

if (($flags & self::REMOVE_UNKNOWN) && ($flags & self::IGNORE_UNKNOWN)) {
throw new \InvalidArgumentException('self::REMOVE_UNKNOWN and self::IGNORE_UNKNOWN are mutually exclusive');
}

if ($flags & self::FORBID_UNKNOWN) {
$this->validateOptionsExistence($options);
} elseif ($flags & self::REMOVE_UNKNOWN) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -789,17 +789,6 @@ public function testClone()
), $clone->resolve());
}

/**
* @expectedException \InvalidArgumentException
*/
public function testRemoveUnknownAndIgnoreUnknownAreMutuallyExclusive()
{
$this->resolver->resolve(array(
'one' => 'one',
'two' => 'two'
), OptionsResolverInterface::REMOVE_UNKNOWN | OptionsResolverInterface::IGNORE_UNKNOWN);
}

public function testRemoveUnknownOption()
{
$this->resolver->setDefaults(array(
Expand Down
0