update v 1.0.7.5
This commit is contained in:
@@ -19,7 +19,7 @@ class NodeTraverser implements NodeTraverserInterface
|
||||
*
|
||||
* @param bool $cloneNodes Should the traverser clone the nodes when traversing the AST
|
||||
*/
|
||||
public function __construct($cloneNodes = true) {
|
||||
public function __construct($cloneNodes = false) {
|
||||
$this->visitors = array();
|
||||
$this->cloneNodes = $cloneNodes;
|
||||
}
|
||||
@@ -99,6 +99,12 @@ class NodeTraverser implements NodeTraverserInterface
|
||||
|
||||
foreach ($this->visitors as $visitor) {
|
||||
if (null !== $return = $visitor->leaveNode($subNode)) {
|
||||
if (is_array($return)) {
|
||||
throw new \LogicException(
|
||||
'leaveNode() may only return an array ' .
|
||||
'if the parent structure is an array'
|
||||
);
|
||||
}
|
||||
$subNode = $return;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user