Browse Source

[Config] Define a common interface for NodeBuilder and TreeBuilder

Victor Berchet 14 years ago
parent
commit
d281409ed5

+ 22 - 0
src/Symfony/Component/Config/Definition/Builder/BuilderInterface.php

@@ -0,0 +1,22 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Config\Definition\Builder;
+
+/**
+ * Defines a common interface for node & tree builders
+ *
+ * @author Victor Berchet <victor@suumit.com>
+ */
+interface BuilderInterface
+{    
+}
+ 

+ 5 - 5
src/Symfony/Component/Config/Definition/Builder/NodeBuilder.php

@@ -16,7 +16,7 @@ namespace Symfony\Component\Config\Definition\Builder;
  *
  * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  */
-class NodeBuilder
+class NodeBuilder implements BuilderInterface
 {
     /************
      * READ-ONLY
@@ -48,11 +48,11 @@ class NodeBuilder
     /**
      * Constructor
      *
-     * @param string      $name   the name of the node
-     * @param string      $type   The type of the node
-     * @param mixed       $parent Either a NodeBuilder or a TreeBuilder instance
+     * @param string            $name   The name of the node
+     * @param string            $type   The type of the node
+     * @param BuilderInterface  $parent A builder instance
      */
-    public function __construct($name, $type, $parent = null)
+    public function __construct($name, $type, BuilderInterface $parent = null)
     {
         $this->name = $name;
         $this->type = $type;

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

@@ -21,7 +21,7 @@ use Symfony\Component\Config\Definition\VariableNode;
  *
  * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  */
-class TreeBuilder
+class TreeBuilder implements BuilderInterface
 {
     protected $root;
     protected $tree;