Add config to set default values
This commit is contained in:
@@ -20,6 +20,21 @@ class Configuration implements ConfigurationInterface
|
|||||||
|
|
||||||
private function addValidationRules(ArrayNodeDefinition $rootNode): void
|
private function addValidationRules(ArrayNodeDefinition $rootNode): void
|
||||||
{
|
{
|
||||||
|
// I've split the tree up like this because Intelephense was crying.
|
||||||
|
// Plus I think it's a little easier to read.
|
||||||
|
|
||||||
|
$rootNode
|
||||||
|
->children()
|
||||||
|
->arrayNode('default')
|
||||||
|
->addDefaultsIfNotSet()
|
||||||
|
->children()
|
||||||
|
->scalarNode('colour')->defaultValue('primary')->end()
|
||||||
|
->integerNode('size')->defaultValue(32)->end()
|
||||||
|
->end()
|
||||||
|
->end()
|
||||||
|
->end()
|
||||||
|
;
|
||||||
|
|
||||||
$rootNode
|
$rootNode
|
||||||
->children()
|
->children()
|
||||||
->arrayNode('directories')
|
->arrayNode('directories')
|
||||||
@@ -34,6 +49,11 @@ class Configuration implements ConfigurationInterface
|
|||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
|
->end()
|
||||||
|
;
|
||||||
|
|
||||||
|
$rootNode
|
||||||
|
->children()
|
||||||
->arrayNode('colours')
|
->arrayNode('colours')
|
||||||
->validate()
|
->validate()
|
||||||
->ifEmpty()
|
->ifEmpty()
|
||||||
|
|||||||
Reference in New Issue
Block a user