Closed
Description
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
*/