8000 [RFC] Deprecate end() in config fluent interface · Issue #26351 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[RFC] Deprecate end() in config fluent interface #26351
Closed
@ro0NL

Description

@ro0NL
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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    ConfigRFCRFC = Request For Comments (proposals about features that you want to be discussed)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0