浏览代码

[Config] Renaming the key attribute removal property for consistency per Johannes' recommendation. Also fixing a PHPDoc typo per Stof.

Ryan Weaver 14 年之前
父节点
当前提交
48459e9082

+ 6 - 6
src/Symfony/Component/Config/Definition/ArrayNode.php

@@ -28,7 +28,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
     protected $children;
     protected $children;
     protected $prototype;
     protected $prototype;
     protected $keyAttribute;
     protected $keyAttribute;
-    protected $keyAttributeIsRemoved;
+    protected $removeKeyAttribute;
     protected $allowFalse;
     protected $allowFalse;
     protected $allowNewKeys;
     protected $allowNewKeys;
     protected $addIfNotSet;
     protected $addIfNotSet;
@@ -49,7 +49,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
 
 
         $this->children = array();
         $this->children = array();
         $this->xmlRemappings = array();
         $this->xmlRemappings = array();
-        $this->keyAttributeIsRemoved = true;
+        $this->removeKeyAttribute = true;
         $this->allowFalse = false;
         $this->allowFalse = false;
         $this->addIfNotSet = false;
         $this->addIfNotSet = false;
         $this->allowNewKeys = true;
         $this->allowNewKeys = true;
@@ -115,9 +115,9 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
      *
      *
      * @param Boolean $remove Whether or not the key attribute should be removed.
      * @param Boolean $remove Whether or not the key attribute should be removed.
      */
      */
-    public function setKeyAttributeIsRemoved($remove)
+    public function setRemoveKeyAttribute($remove)
     {
     {
-        $this->keyAttributeIsRemoved = $remove;
+        $this->removeKeyAttribute = $remove;
     }
     }
 
 
     /**
     /**
@@ -394,7 +394,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
                         $k = $v[$this->keyAttribute];
                         $k = $v[$this->keyAttribute];
 
 
                         // remove the key attribute if configured to
                         // remove the key attribute if configured to
-                        if ($this->keyAttributeIsRemoved) {
+                        if ($this->removeKeyAttribute) {
                             unset($v[$this->keyAttribute]);
                             unset($v[$this->keyAttribute]);
                         }
                         }
                     }
                     }
@@ -497,7 +497,7 @@ class ArrayNode extends BaseNode implements PrototypeNodeInterface
     }
     }
 
 
     /**
     /**
-     * Set whether or not to this array should just prevent child values from
+     * Set whether or not this array should just prevent child values from
      * keys that have no corresponding child nodes.
      * keys that have no corresponding child nodes.
      *
      *
      * If true (default), an exception will be thrown if unrecognized options
      * If true (default), an exception will be thrown if unrecognized options

+ 1 - 1
src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php

@@ -167,7 +167,7 @@ class TreeBuilder
 
 
         if (null !== $node->key) {
         if (null !== $node->key) {
             $configNode->setKeyAttribute($node->key);
             $configNode->setKeyAttribute($node->key);
-            $configNode->setKeyAttributeIsRemoved($node->removeKeyItem);
+            $configNode->setRemoveKeyAttribute($node->removeKeyItem);
         }
         }
 
 
         if (true === $node->atLeastOne) {
         if (true === $node->atLeastOne) {

+ 1 - 1
tests/Symfony/Tests/Component/Config/Definition/ArrayNodeTest.php

@@ -129,7 +129,7 @@ class ArrayNodeTest extends \PHPUnit_Framework_TestCase
     {
     {
         $node = new ArrayNode('root');
         $node = new ArrayNode('root');
         $node->setKeyAttribute('id');
         $node->setKeyAttribute('id');
-        $node->setKeyAttributeIsRemoved(false);
+        $node->setRemoveKeyAttribute(false);
 
 
         $prototype = new ArrayNode(null);
         $prototype = new ArrayNode(null);
         $prototype->setPreventExtraKeys(false); // just so it allows anything
         $prototype->setPreventExtraKeys(false); // just so it allows anything