Skip to content

Commit a135690

Browse files
bug symfony#25048 Allow EnumNode name to be null (MatTheCat)
This PR was squashed before being merged into the 4.0-dev branch (closes symfony#25048). Discussion ---------- Allow EnumNode name to be null | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#25046 | License | MIT Commits ------- 57d0636 Allow EnumNode name to be null
2 parents 7bb7b0d + 57d0636 commit a135690

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Symfony/Component/Config/Definition/EnumNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class EnumNode extends ScalarNode
2222
{
2323
private $values;
2424

25-
public function __construct(string $name, NodeInterface $parent = null, array $values = array())
25+
public function __construct(?string $name, NodeInterface $parent = null, array $values = array())
2626
{
2727
$values = array_unique($values);
2828
if (empty($values)) {

src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ public function testConstructionWithOneDistinctValue()
4343
$this->assertSame('foo', $node->finalize('foo'));
4444
}
4545

46+
public function testConstructionWithNullName()
47+
{
48+
$node = new EnumNode(null, null, array('foo'));
49+
$this->assertSame('foo', $node->finalize('foo'));
50+
}
51+
4652
/**
4753
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
4854
* @expectedExceptionMessage The value "foobar" is not allowed for path "foo". Permissible values: "foo", "bar"

0 commit comments

Comments
 (0)