Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Extracted OptionsResolver component out of Form #3968

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

Merged
merged 12 commits into from
May 15, 2012
Merged
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] Fixed doc and block nesting
  • Loading branch information
webmozart committed May 14, 2012
commit 9c76750cb8aea89ea51b28fbda8fb6081a50f434
10 changes: 5 additions & 5 deletions src/Symfony/Component/OptionsResolver/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,39 +165,39 @@ public function offsetUnset($option)
}

/**
* @see Iterator::current()
* {@inheritdoc}
*/
public function current()
{
return $this->offsetGet($this->key());
}

/**
* @see Iterator::next()
* {@inheritdoc}
*/
public function next()
{
next($this->options);
}

/**
* @see Iterator::key()
* {@inheritdoc}
*/
public function key()
{
return key($this->options);
}

/**
* @see Iterator::valid()
* {@inheritdoc}
*/
public function valid()
{
return null !== $this->key();
}

/**
* @see Iterator::rewind()
* {@inheritdoc}
*/
public function rewind()
{
Expand Down
16 changes: 8 additions & 8 deletions src/Symfony/Component/OptionsResolver/OptionsResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ private function validateOptionNames(array $optionNames)

sort($diff);

if (count($diff) > 1) {
throw new InvalidOptionsException(sprintf('The options "%s" do not exist. Known options are: "%s"', implode('", "', $diff), implode('", "', $knownOptions)));
}

if (count($diff) > 0) {
if (count($diff) > 1) {
throw new InvalidOptionsException(sprintf('The options "%s" do not exist. Known options are: "%s"', implode('", "', $diff), implode('", "', $knownOptions)));
}

throw new InvalidOptionsException(sprintf('The option "%s" does not exist. Known options are: "%s"', current($diff), implode('", "', $knownOptions)));
}

Expand All @@ -268,11 +268,11 @@ private function validateOptionNames(array $optionNames)

sort($diff);

if (count($diff) > 1) {
throw new MissingOptionsException(sprintf('The options "%s" are missing.', implode('", "', $diff)));
}

if (count($diff) > 0) {
if (count($diff) > 1) {
throw new MissingOptionsException(sprintf('The options "%s" are missing.', implode('", "', $diff)));
}

throw new MissingOptionsException(sprintf('The option "%s" is missing.', current($diff)));
}
}
Expand Down