merged branch vicb/resolver_options (PR #5110)

Commits
-------

a47922b [OptionsResolver] Fix Options::has() when the value is null

Discussion
----------

[OptionsResolver] Fix Options::has() when the value is null

`isset()` would have returned `false` when the value is `null`
This commit is contained in:
Fabien Potencier 2012-07-30 10:08:33 +02:00
commit cbd03ec4c6
2 changed files with 8 additions and 1 deletions

View File

@ -247,7 +247,7 @@ class Options implements \ArrayAccess, \Iterator, \Countable
*/
public function has($option)
{
return isset($this->options[$option]);
return array_key_exists($option, $this->options);
}
/**

View File

@ -462,4 +462,11 @@ class OptionsTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expectedResult, iterator_to_array($this->options, true));
}
public function testHasWithNullValue()
{
$this->options->set('foo', null);
$this->assertTrue($this->options->has('foo'));
}
}