I am developing a Symfony2 application and I want to be able to use a configuration file like this:
my_config:
values: ['val1', 'val2']
So I created the following configuration file:
class Configuration implements ConfigurationInterface {
public function getConfigTreeBuilder() {
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('my_config');
$rootNode
->children()
->arrayNode('values')
->prototype('scalar')->end()
->end()
->end()
;
return $treeBuilder;
}
}
This configuration, however, lets me add something like:
my_config:
values: ['val1', 123, false]
Is there a way to enforce array values to be of type String (e.g. something like prototype('string'))?