8000 bug #20253 [TwigBridge] Use non-deprecated Twig_Node::getTemplateLine… · symfony/symfony@8974d77 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8974d77

Browse files
committed
bug #20253 [TwigBridge] Use non-deprecated Twig_Node::getTemplateLine() (fabpot)
This PR was merged into the 2.7 branch. Discussion ---------- [TwigBridge] Use non-deprecated Twig_Node::getTemplateLine() | Q | A | ------------- | --- | Branch? |2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Commits ------- bb791d0 [TwigBridge] Use non-deprecated Twig_Node::getTemplateLine()
2 parents 8a420c5 + bb791d0 commit 8974d77

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/Symfony/Bridge/Twig/Node/SearchAndRenderBlockNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function compile(\Twig_Compiler $compiler)
3737
// the variables in the third argument
3838
$label = $arguments[1];
3939
$variables = isset($arguments[2]) ? $arguments[2] : null;
40-
$lineno = $label->getLine();
40+
$lineno = $label->getTemplateLine();
4141

4242
if ($label instanceof \Twig_Node_Expression_Constant) {
4343
// If the label argument is given as a constant, we can either

src/Symfony/Bridge/Twig/Node/TransNode.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,18 @@ protected function compileString(\Twig_Node $body, \Twig_Node_Expression_Array $
109109
preg_match_all('/(?<!%)%([^%]+)%/', $msg, $matches);
110110

111111
foreach ($matches[1] as $var) {
112-
$key = new \Twig_Node_Expression_Constant('%'.$var.'%', $body->getLine());
112+
$key = new \Twig_Node_Expression_Constant('%'.$var.'%', $body->getTemplateLine());
113113
if (!$vars->hasElement($key)) {
114114
if ('count' === $var && $this->hasNode('count')) {
115115
$vars->addElement($this->getNode('count'), $key);
116116
} else {
117-
$varExpr = new \Twig_Node_Expression_Name($var, $body->getLine());
117+
$varExpr = new \Twig_Node_Expression_Name($var, $body->getTemplateLine());
118118
$varExpr->setAttribute('ignore_strict_check', $ignoreStrictCheck);
119119
$vars->addElement($varExpr, $key);
120120
}
121121
}
122122
}
123123

124-
return array(new \Twig_Node_Expression_Constant(str_replace('%%', '%', trim($msg)), $body->getLine()), $vars);
124+
return array(new \Twig_Node_Expression_Constant(str_replace('%%', '%', trim($msg)), $body->getTemplateLine()), $vars);
125125
}
126126
}

src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ protected function doEnterNode(\Twig_Node $node, \Twig_Environment $env)
5050
return $node;
5151
} else {
5252
$var = $env->getParser()->getVarName();
53-
$name = new \Twig_Node_Expression_AssignName($var, $node->getLine());
54-
$this->scope->set('domain', new \Twig_Node_Expression_Name($var, $node->getLine()));
53+
$name = new \Twig_Node_Expression_AssignName($var, $node->getTemplateLine());
54+
$this->scope->set('domain', new \Twig_Node_Expression_Name($var, $node->getTemplateLine()));
5555

56-
return new \Twig_Node_Set(false, new \Twig_Node(array($name)), new \Twig_Node(array($node->getNode('expr'))), $node->getLine());
56+
return new \Twig_Node_Set(false, new \Twig_Node(array($name)), new \Twig_Node(array($node->getNode('expr'))), $node->getTemplateLine());
5757
}
5858
}
5959

@@ -71,7 +71,7 @@ protected function doEnterNode(\Twig_Node $node, \Twig_Environment $env)
7171
} else {
7272
if (!$arguments->hasNode($ind)) {
7373
if (!$arguments->hasNode($ind - 1)) {
74-
$arguments->setNode($ind - 1, new \Twig_Node_Expression_Array(array(), $node->getLine()));
74+
$arguments->setNode($ind - 1, new \Twig_Node_Expression_Array(array(), $node->getTemplateLine()));
7575
}
7676

7777
$arguments->setNode($ind, $this->scope->get('domain'));

src/Symfony/Bridge/Twig/TokenParser/TransChoiceTokenParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function parse(\Twig_Token $token)
6464
$body = $this->parser->subparse(array($this, 'decideTransChoiceFork'), true);
6565

6666
if (!$body instanceof \Twig_Node_Text && !$body instanceof \Twig_Node_Expression) {
67-
throw new \Twig_Error_Syntax('A message inside a transchoice tag must be a simple text.', $body->getLine(), $stream->getSourceContext()->getName());
67+
throw new \Twig_Error_Syntax('A message inside a transchoice tag must be a simple text.', $body->getTemplateLine(), $stream->getSourceContext()->getName());
6868
}
6969

7070
$stream->expect(\Twig_Token::BLOCK_END_TYPE);

src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function parse(\Twig_Token $token)
6464
$body = $this->parser->subparse(array($this, 'decideTransFork'), true);
6565

6666
if (!$body instanceof \Twig_Node_Text && !$body instanceof \Twig_Node_Expression) {
67-
throw new \Twig_Error_Syntax('A message inside a trans tag must be a simple text.', $body->getLine(), $stream->getSourceContext()->getName());
67+
throw new \Twig_Error_Syntax('A message inside a trans tag must be a simple text.', $body->getTemplateLine(), $stream->getSourceContext()->getName());
6868
}
6969

7070
$stream->expect(\Twig_Token::BLOCK_END_TYPE);

0 commit comments

Comments
 (0)
0