minor #31281 [TwigBridge] Fix deprecation on twig 2.9 (chalasr)

This PR was merged into the 3.4 branch.

Discussion
----------

[TwigBridge] Fix deprecation on twig 2.9

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes$
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

should make travis green

Commits
-------

ac8256ba9c [TwigBridge] Fix deprecation on twig 2.9
This commit is contained in:
Nicolas Grekas 2019-04-27 10:50:03 +02:00
commit a975d2ba84
1 changed files with 3 additions and 1 deletions

View File

@ -24,6 +24,7 @@ use Twig\Node\ModuleNode;
use Twig\Node\Node;
use Twig\Node\SetNode;
use Twig\NodeVisitor\AbstractNodeVisitor;
use Twig\TokenParser\ApplyTokenParser;
/**
* @author Fabien Potencier <fabien@symfony.com>
@ -95,7 +96,8 @@ class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor
protected function doLeaveNode(Node $node, Environment $env)
{
if ($node instanceof TransDefaultDomainNode) {
return false;
// must return null as of Twig 2.9
return class_exists(ApplyTokenParser::class) ? null : false;
}
if ($node instanceof BlockNode || $node instanceof ModuleNode) {