Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8668aec

Browse files
committed
minor #20421 Twig deprecation removal (fabpot)
This PR was merged into the 2.7 branch. Discussion ---------- Twig deprecation removal | 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 ------- eb0d6c9 removed a deprecation notice
2 parents b06c00e + eb0d6c9 commit 8668aec

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ protected function doEnterNode(\Twig_Node $node, \Twig_Environment $env)
4949

5050
return $node;
5151
} else {
52-
$var = $env->getParser()->getVarName();
52+
$var = $this->getVarName();
5353
$name = new \Twig_Node_Expression_AssignName($var, $node->getTemplateLine());
5454
$this->scope->set('domain', new \Twig_Node_Expression_Name($var, $node->getTemplateLine()));
5555

@@ -123,4 +123,9 @@ private function isNamedArguments($arguments)
123123

124124
return false;
125125
}
126+
127+
private function getVarName()
128+
{
129+
return sprintf('__internal_%s', hash('sha256', uniqid(mt_rand(), true), false));
130+
}
126131
}

0 commit comments

Comments
 (0)