Closed
Description
Q | A |
---|---|
Bug report? | no |
Feature request? | yes |
BC Break report? | no |
RFC? | yes |
Symfony version | 4.x |
I believe this was already proposed once when building the DI fluent config format. Moreover, i think it's possible in a way.. relying on something like what's currently also being proposed for DI config: #25650
However for Config component it would be required to do it that way, as without end()
we dont know the scope of the node definition (meaning based on indentation things could either apply to a child- or parent node).
Overall, i think it could be a cool step. Aiming for a bit more simplicity as well as better support for custom node types in the long run.
Im thinking something along the lines of:
<?php
$rootNode
->children(function (YourNodeBuilder $builder): void {
$builder
->scalarNode('foo')
->isRequired()
->booleanNode('bar')
->cannotBeEmpty();
})
->validate()->always(function ($value) {
// ...
});
Thoughts?