mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-04 06:30:57 +00:00
bug #4050 synchronize sourceContext (Lumaraf)
This PR was squashed before being merged into the 3.x branch.
Discussion
----------
synchronize sourceContext
I have some debugging extensions that need the template name from various nodes in a `NodeVisitor`. Currently this is guaranteed for the nodes created from parsing the template. This ensures that the `SourceContext` is also set for nodes created by `NodeVisitors` modifying the node tree.
I am not sure if it is a good idea to always set the `SourceContext` on a child node or if this should only set it if it is not set.
Commits
-------
350670a3 synchronize sourceContext
This commit is contained in:
@@ -138,6 +138,9 @@ class Node implements \Countable, \IteratorAggregate
|
||||
|
||||
public function setNode(string $name, self $node): void
|
||||
{
|
||||
if (null !== $this->sourceContext) {
|
||||
$node->setSourceContext($this->sourceContext);
|
||||
}
|
||||
$this->nodes[$name] = $node;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user