8000 Extracted OptionsResolver component out of Form by webmozart · Pull Request #3968 · symfony/symfony · GitHub
[go: up one dir, main page]

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 typos
  • Loading branch information
webmozart committed May 14, 2012
commit 95454f5f6b7a3c929cdb6ff8c838f3f436d281ac
25 changes: 13 additions & 12 deletions src/Symfony/Component/OptionsResolver/OptionsResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ public function __construct()
/**
* Sets default option values.
*
* @param array $options A list of option names as keys and default values
* as values. The option values may be closures
* of the following signatures:
* @param array $defaultValues A list of option names as keys and default values
* as values. The option values may be closures
* of the following signatures:
*
* - function (Options $options)
* - function (Options $options, $previousValue)
* - function (Options $options)
* - function (Options $options, $previousValue)
*/
public function setDefaults(array $defaultValues)
{
Expand All @@ -80,11 +80,11 @@ public function setDefaults(array $defaultValues)
* performance if the previous default value is calculated by an expensive
* closure.
*
* @param array $options A list of option names as keys and default values
* as values. The option values may be closures
* of the following signature:
* @param array $defaultValues A list of option names as keys and default values
* as values. The option values may be closures
* of the following signature:
*
* - function (Options $options)
* - function (Options $options)
*/
public function replaceDefaults(array $defaultValues)
{
Expand Down Expand Up @@ -214,10 +214,11 @@ public function resolve(array $options)
* Validates that the given option names exist and throws an exception
* otherwise.
*
* @param array $optionNames A list of option names.
* @param array $optionNames A list of option names.
*
* @throws InvalidOptionsException If any of the options has not been
* defined.
* @throws InvalidOptionsException If any of the options has not been
* defined.
* @throws MissingOptionsException If a required option is missing.
*/
private function validateOptionNames(array $optionNames)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/OptionsResolver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ possible, and may only be one of "male" and "female".
public function __construct(array $options = array())
{
$resolver = new OptionsResolver();
$this->configureOptions($resolver);
$this->configure($resolver);

$this->options = $resolver->resolve($options);
}
Expand Down Expand Up @@ -53,7 +53,7 @@ possible, and may only be one of "male" and "female".

We can now easily instantiate a Person object:

// 'gender' is implicitely set to 'female'
// 'gender' is implicitly set to 'female'
$person = new Person(array(
'firstName' => 'Jane',
'lastName' => 'Doe',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@

class OptionsResolverTest extends \PHPUnit_Framework_TestCase
{
private $options;
/**
* @var OptionsResolver
*/
private $resolver;

protected function setUp()
{
Expand Down
0