Skip to content

Commit

Permalink
Merge pull request #353 from jderusse/yield-deprec
Browse files Browse the repository at this point in the history
Fix deprecation with CSPNode yield
  • Loading branch information
Seldaek authored Jul 1, 2024
2 parents b56d37e + f1a3b73 commit 6a12626
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Twig/Node/CSPNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ public function compile(Compiler $compiler): void
} else {
throw new \InvalidArgumentException(sprintf('Unable to compile for directive "%s"', $this->directive));
}
$compiler->write("echo \$content;\n");

if (class_exists(CaptureNode::class)) {
$compiler->write("yield \$content;\n");
} else {
$compiler->write("echo \$content;\n");
}
}
}

0 comments on commit 6a12626

Please sign in to comment.