mirror of
https://github.com/twigphp/Twig.git
synced 2026-10-16 16:55:13 +00:00
Merge branch '1.x' into 2.x
* 1.x: added more tests added missing hints in some runtime exceptions
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
namespace Twig\Node;
|
||||
|
||||
use Twig\Compiler;
|
||||
use Twig\Source;
|
||||
|
||||
/**
|
||||
* Represents a node in the AST.
|
||||
@@ -27,6 +28,7 @@ class Node implements \Countable, \IteratorAggregate
|
||||
protected $tag;
|
||||
|
||||
private $name;
|
||||
private $sourceContext;
|
||||
|
||||
/**
|
||||
* @param array $nodes An array of named nodes
|
||||
@@ -178,6 +180,21 @@ class Node implements \Countable, \IteratorAggregate
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setSourceContext(Source $source)
|
||||
{
|
||||
$this->sourceContext = $source;
|
||||
foreach ($this->nodes as $node) {
|
||||
if (null !== $node) {
|
||||
$node->setSourceContext($source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getSourceContext()
|
||||
{
|
||||
return $this->sourceContext;
|
||||
}
|
||||
}
|
||||
|
||||
class_alias('Twig\Node\Node', 'Twig_Node');
|
||||
|
||||
Reference in New Issue
Block a user