Permalink
Browse files

bug #23073 [TwigBridge] Fix namespaced classes (ogizanagi)

This PR was merged into the 2.7 branch.

Discussion
----------

[TwigBridge] Fix namespaced classes

| Q             | A
| ------------- | ---
| Branch?       | 2.7 <!-- see comment below -->
| Bug fix?      | yes
| New feature?  | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #23072 <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A

Commits
-------

a1cdc2d [TwigBridge] Fix namespaced classes
  • Loading branch information...
fabpot committed Jun 6, 2017
2 parents 621b769 + a1cdc2d commit 658236b34474043ba29ddd38c018b6a7d9b28e38
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php
@@ -14,13 +14,15 @@
use Symfony\Bridge\Twig\Node\TransNode;
use Symfony\Bridge\Twig\Node\TransDefaultDomainNode;
use Twig\Environment;
use Twig\Node\BlockNode;
use Twig\Node\Expression\ArrayExpression;
use Twig\Node\Expression\AssignNameExpression;
use Twig\Node\Expression\ConstantExpression;
use Twig\Node\Expression\FilterExpression;
use Twig\Node\Expression\NameExpression;
use Twig\Node\ModuleNode;
use Twig\Node\Node;
use Twig\Node\SetNode;
use Twig\NodeVisitor\AbstractNodeVisitor;
/**
@@ -48,7 +50,7 @@ public function __construct()
*/
protected function doEnterNode(Node $node, Environment $env)
{
if ($node instanceof Node_Block || $node instanceof ModuleNode) {
if ($node instanceof BlockNode || $node instanceof ModuleNode) {
$this->scope = $this->scope->enter();
}
@@ -62,7 +64,7 @@ protected function doEnterNode(Node $node, Environment $env)
$name = new AssignNameExpression($var, $node->getTemplateLine());
$this->scope->set('domain', new NameExpression($var, $node->getTemplateLine()));
return new Node_Set(false, new Node(array($name)), new Node(array($node->getNode('expr'))), $node->getTemplateLine());
return new SetNode(false, new Node(array($name)), new Node(array($node->getNode('expr'))), $node->getTemplateLine());
}
}
@@ -104,7 +106,7 @@ protected function doLeaveNode(Node $node, Environment $env)
return false;
}
if ($node instanceof Node_Block || $node instanceof ModuleNode) {
if ($node instanceof BlockNode || $node instanceof ModuleNode) {
$this->scope = $this->scope->leave();
}

0 comments on commit 658236b

Please sign in to comment.