aboutsummaryrefslogtreecommitdiffstats
path: root/Llk
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2016-08-08 17:31:12 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2016-08-08 17:31:12 +0200
commit4e2d5b780d83daedb0950fbaf245159a04c89d7e (patch)
treef8de154c708fd9c13fd07f22f83280063c518893 /Llk
parent860e86d1f0b9eb60cf1f44bf774012708c386d72 (diff)
downloadCompiler-4e2d5b780d83daedb0950fbaf245159a04c89d7e.zip
Compiler-4e2d5b780d83daedb0950fbaf245159a04c89d7e.tar.gz
Compiler-4e2d5b780d83daedb0950fbaf245159a04c89d7e.tar.bz2
TreeNode: Force the value to be an array.
Diffstat (limited to 'Llk')
-rw-r--r--Llk/TreeNode.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/Llk/TreeNode.php b/Llk/TreeNode.php
index a1c7dfd..2bf2879 100644
--- a/Llk/TreeNode.php
+++ b/Llk/TreeNode.php
@@ -58,9 +58,9 @@ class TreeNode implements Visitor\Element
/**
* Value of the node (non-null for token nodes).
*
- * @var string
+ * @var array
*/
- protected $_value = null;
+ protected $_value = [];
/**
* Children.
@@ -89,16 +89,16 @@ class TreeNode implements Visitor\Element
* Constructor.
*
* @param string $id ID.
- * @param string $value Value.
+ * @param array $value Value.
* @param array $children Children.
* @param \Hoa\Compiler\Llk\TreeNode $parent Parent.
* @return void
*/
public function __construct(
$id,
- $value = null,
- array $children = [],
- TreeNode $parent = null
+ array $value = [],
+ array $children = [],
+ self $parent = null
) {
$this->setId($id);
$this->setValue($value);
@@ -141,7 +141,7 @@ class TreeNode implements Visitor\Element
* @param array $value Value (token & value).
* @return array
*/
- public function setValue($value)
+ public function setValue(array $value)
{
$old = $this->_value;
$this->_value = $value;
@@ -186,7 +186,7 @@ class TreeNode implements Visitor\Element
*/
public function isToken()
{
- return null !== $this->_value;
+ return !empty($this->_value);
}
/**