[Config] renamed keepKeys() to normalizeKeys() (refs #6367)

This commit is contained in:
Fabien Potencier 2012-12-16 17:56:50 +01:00
parent 4f0cf08523
commit 8df9b7a2de
3 changed files with 8 additions and 6 deletions

View File

@ -76,7 +76,7 @@ class Configuration implements ConfigurationInterface
->fixXmlConfig('global')
->children()
->arrayNode('globals')
->keepKeys()
->normalizeKeys(false)
->useAttributeAsKey('key')
->example(array('foo' => '"@bar"', 'pi' => 3.14))
->prototype('array')
@ -127,7 +127,7 @@ class Configuration implements ConfigurationInterface
->scalarNode('auto_reload')->end()
->scalarNode('optimizations')->end()
->arrayNode('paths')
->keepKeys()
->normalizeKeys(false)
->beforeNormalization()
->always()
->then(function ($paths) {

View File

@ -4,7 +4,7 @@ CHANGELOG
2.2.0
-----
* added a `keepKeys()` method for array nodes (to avoid key normalization)
* added a `normalizeKeys()` method for array nodes (to avoid key normalization)
* added numerical type handling for config definitions
* added convenience methods for optional configuration sections to ArrayNodeDefinition
* added a utils class for XML manipulations

View File

@ -284,13 +284,15 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
}
/**
* Disables key normalization.
* Sets key normalization.
*
* @param Boolean $bool Whether to enable key normalization
*
* @return ArrayNodeDefinition
*/
public function keepKeys()
public function normalizeKeys($bool)
{
$this->normalizeKeys = false;
$this->normalizeKeys = (Boolean) $bool;
return $this;
}