Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[DependencyInjection] ArrayNodeDefinition::canBeEnabled() doesn't make the configuration disabled by default #25760

Copy link
Copy link
Closed
@jakzal

Description

@jakzal
Issue body actions
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 2.7

Consider the following configuration:

$builder = new TreeBuilder();
$root = $builder->root('acme_foo');
$root->canBeEnabled();

Expected behaviour

If the section wasn't provided in configuration, it will be disabled.

Actual Behaviour

The section is enabled unless it was explicitly disabled.

Supporting information

It only seems to be an issue for root nodes. Any child nodes work as expected (i.e. $root->children()->arrayNode('foo')->canBeEnabled()).

The docblock for canBeEnabled() says that the section should be disabled by default (which is also what I expected):

    /**
     * Adds an "enabled" boolean to enable the current section.
     *
     * By default, the section is disabled. If any configuration is specified then
     * the node will be automatically enabled:
     *
     * enableableArrayNode: {enabled: true, ...}   # The config is enabled & default values get overridden
     * enableableArrayNode: ~                      # The config is enabled & use the default values
     * enableableArrayNode: true                   # The config is enabled & use the default values
     * enableableArrayNode: {other: value, ...}    # The config is enabled & default values get overridden
     * enableableArrayNode: {enabled: false, ...}  # The config is disabled
     * enableableArrayNode: false                  # The config is disabled
     */

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.