Skip to content

Commit

Permalink
Merge pull request #101 from pan93412/fix-issue-100
Browse files Browse the repository at this point in the history
Do not pass "$tag" parameter to Twig_Node constructor
  • Loading branch information
notFloran authored Dec 11, 2024
2 parents 651865d + 875378c commit 83d8e44
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Twig/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,20 @@ class Node extends Twig_Node
*/
public function __construct(Twig_Node $value, $line, $tag = null)
{
$twigGreaterThan312 = version_compare(\Twig\Environment::VERSION, '3.12', '>=');

if (class_exists(CaptureNode::class)) {
$value = new CaptureNode($value, $line, $tag);
$value = $twigGreaterThan312
? new CaptureNode($value, $line)
: new CaptureNode($value, $line, $tag);
$value->setAttribute('raw', true);
}

parent::__construct(['value' => $value], ['name' => $tag], $line, $tag);
if ($twigGreaterThan312) {
parent::__construct(['value' => $value], ['name' => $tag], $line);
} else {
parent::__construct(['value' => $value], ['name' => $tag], $line, $tag);
}
}

/**
Expand Down

0 comments on commit 83d8e44

Please sign in to comment.