8000 [TwigBundle] updated nodes for the latest version of Twig · brtriver/symfony@7712528 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7712528

Browse files
committed
[TwigBundle] updated nodes for the latest version of Twig
1 parent 8e654e8 commit 7712528

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/Symfony/Bundle/TwigBundle/Node/TransNode.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ public function compile($compiler)
3232
{
3333
$compiler->addDebugInfo($this);
3434

35-
if ($this['is_simple']) {
36-
list($msg, $vars) = $this->compileString($this->body);
35+
if ($this->getAttribute('is_simple')) {
36+
list($msg, $vars) = $this->compileString($this->getNode('body'));
3737
} else {
38-
$msg = $this->body;
39-
$vars = $this->vars;
38+
$msg = $this->getNode('body');
39+
$vars = $this->getNode('vars');
4040
}
4141

42-
$method = null === $this->count ? 'trans' : 'transChoice';
42+
$method = null === $this->getNode('count') ? 'trans' : 'transChoice';
4343

4444
$compiler
4545
->write('echo $this->env->getExtension(\'translator\')->getTranslator()->'.$method.'(')
@@ -48,9 +48,9 @@ public function compile($compiler)
4848

4949
$compiler->raw(', ');
5050

51-
if (null !== $this->count) {
51+
if (null !== $this->getNode('count')) {
5252
$compiler
53-
->subcompile($this->count)
53+
->subcompile($this->getNode('count'))
5454
->raw(', ')
5555
;
5656
}
@@ -74,7 +74,7 @@ public function compile($compiler)
7474

7575
$compiler
7676
->raw("), ")
77-
->subcompile($this->domain)
77+
->subcompile($this->getNode('domain'))
7878
->raw(");\n")
7979
;
8080
}
@@ -89,14 +89,14 @@ protected function compileString(\Twig_NodeInterface $body)
8989
$vars = array();
9090
foreach ($body as $node) {
9191
if ($node instanceof \Twig_Node_Print) {
92-
$n = $node->expr;
92+
$n = $node->getNode('expr');
9393
while ($n instanceof \Twig_Node_Expression_Filter) {
94-
$n = $n->node;
94+
$n = $n->getNode('node');
9595
}
96-
$msg .= sprintf('{{ %s }}', $n['name']);
97-
$vars[] = new \Twig_Node_Expression_Name($n['name'], $n->getLine());
96+
$msg .= sprintf('{{ %s }}', $n->getAttribute('name'));
97+
$vars[] = new \Twig_Node_Expression_Name($n->getAttribute('name'), $n->getLine());
9898
} else {
99-
$msg .= $node['data'];
99+
$msg .= $node->getAttribute('data');
100100
}
101101
}
102102

0 commit comments

Comments
 (0)
0