Skip to content

Commit c9c7798

Browse files
committed
Changed the node type for the key named "key"
1 parent 54facb0 commit c9c7798

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Configuration/Parameters.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
66
use Symfony\Component\Config\Definition\ConfigurationInterface;
7+
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
78
use function Kiboko\Component\SatelliteToolbox\Configuration\asExpression;
89
use function Kiboko\Component\SatelliteToolbox\Configuration\isExpression;
910

@@ -23,12 +24,18 @@ public function getConfigTreeBuilder()
2324
->end()
2425
->arrayPrototype()
2526
->children()
26-
->scalarNode('key')
27+
->variableNode('key')
2728
->isRequired()
2829
->validate()
2930
->ifTrue(isExpression())
3031
->then(asExpression())
3132
->end()
33+
->validate()
34+
->ifTrue(function ($value) {
35+
return !is_string($value) && !is_int($value);
36+
})
37+
->thenInvalid('The parameter\'s key must be of a string or an integer.')
38+
->end()
3239
->end()
3340
->scalarNode('value')
3441
->isRequired()

0 commit comments

Comments
 (0)