mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-08 16:36:58 +00:00
allowed Twig\NodeVisitor\NodeVisitorInterface::leaveNode() to return "null" instead of "false" (same meaning)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
* 1.40.0 (2019-XX-XX)
|
||||
|
||||
* allowed Twig\NodeVisitor\NodeVisitorInterface::leaveNode() to return "null" instead of "false" (same meaning)
|
||||
* added the "apply" tag as a replacement for the "filter" tag
|
||||
* allowed Twig\Loader\FilesystemLoader::findTemplate() to return "null" instead of "false" (same meaning)
|
||||
* added support for "Twig\Markup" instances in the "in" test
|
||||
|
||||
@@ -69,7 +69,7 @@ class NodeTraverser
|
||||
$node = $visitor->enterNode($node, $this->env);
|
||||
|
||||
foreach ($node as $k => $n) {
|
||||
if (false !== $m = $this->traverseForVisitor($visitor, $n)) {
|
||||
if (false !== ($m = $this->traverseForVisitor($visitor, $n)) && null !== $m) {
|
||||
if ($m !== $n) {
|
||||
$node->setNode($k, $m);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ use Twig\Node\Node;
|
||||
/**
|
||||
* Used to make node visitors compatible with Twig 1.x and 2.x.
|
||||
*
|
||||
* To be removed in Twig 3.1.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
abstract class AbstractNodeVisitor implements NodeVisitorInterface
|
||||
@@ -49,7 +51,7 @@ abstract class AbstractNodeVisitor implements NodeVisitorInterface
|
||||
/**
|
||||
* Called after child nodes are visited.
|
||||
*
|
||||
* @return Node|false The modified node or false if the node must be removed
|
||||
* @return Node|false|null The modified node or null if the node must be removed
|
||||
*/
|
||||
abstract protected function doLeaveNode(Node $node, Environment $env);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ interface NodeVisitorInterface
|
||||
/**
|
||||
* Called after child nodes are visited.
|
||||
*
|
||||
* @return \Twig_NodeInterface|false The modified node or false if the node must be removed
|
||||
* @return \Twig_NodeInterface|false|null The modified node or null if the node must be removed
|
||||
*/
|
||||
public function leaveNode(\Twig_NodeInterface $node, Environment $env);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user