diff --git a/src/Symfony/Component/Config/Definition/EnumNode.php b/src/Symfony/Component/Config/Definition/EnumNode.php index e8821cf51a6e6..7fc8bf1699f86 100644 --- a/src/Symfony/Component/Config/Definition/EnumNode.php +++ b/src/Symfony/Component/Config/Definition/EnumNode.php @@ -22,7 +22,7 @@ class EnumNode extends ScalarNode { private $values; - public function __construct(string $name, NodeInterface $parent = null, array $values = array()) + public function __construct(?string $name, NodeInterface $parent = null, array $values = array()) { $values = array_unique($values); if (empty($values)) { diff --git a/src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php index e3e7ef05946fc..48468db2604c0 100644 --- a/src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php @@ -43,6 +43,12 @@ public function testConstructionWithOneDistinctValue() $this->assertSame('foo', $node->finalize('foo')); } + public function testConstructionWithNullName() + { + $node = new EnumNode(null, null, array('foo')); + $this->assertSame('foo', $node->finalize('foo')); + } + /** * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException * @expectedExceptionMessage The value "foobar" is not allowed for path "foo". Permissible values: "foo", "bar"