symfony/symfony — pull request #5132 by EvanK (2012-08-01 01:37:12+00:00)
Title: [OptionsResolver] validateOptionTypes raises error for optional, nonexistant option values

The [`OptionsResolver#validateOptionTypes`](https://github.com/symfony/OptionsResolver/blob/master/OptionsResolver.php#L315) method should check if a given option value exists before trying to test its type:

```php
setOptional(array('one', 'two'))->setAllowedTypes(array('one' => 'string', 'two' => 'int'));

// Correctly fails as wrong type
$resolver->resolve(array('one' => 1, 'two' => 'alpha'));

// Correctly succeeds
$resolver->resolve(array('one' => 'alpha', 'two' => 1));

// Raises error "Undefined index: two", see OptionsResolver.php line 315
$resolver->resolve(array('one' => 'alpha'));
```