You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (null !== $domainNode = $node->getNode('domain')) {
59
+
if (!$this->checkNodeIsConstant($domainNode)) {
60
+
return$node;
61
+
}
50
62
$domain = $domainNode->getAttribute('value');
51
63
}
52
64
@@ -58,10 +70,8 @@ public function enterNode(\Twig_NodeInterface $node, \Twig_Environment $env)
58
70
59
71
if ('trans' === $name || 'transchoice' === $name) {
60
72
$idNode = $node->getNode('node');
61
-
if (!$idNodeinstanceof \Twig_Node_Expression_Constant) {
73
+
if (!$this->checkNodeIsConstant($idNode)) {
62
74
return$node;
63
-
// FIXME: see below
64
-
// throw new \RuntimeException(sprintf('Cannot infer translation id from node "%s". Please refactor to only translate constants.', get_class($idNode)));
65
75
}
66
76
$id = $idNode->getAttribute('value');
67
77
@@ -70,10 +80,8 @@ public function enterNode(\Twig_NodeInterface $node, \Twig_Environment $env)
70
80
$arguments = $node->getNode('arguments');
71
81
if ($arguments->hasNode($index)) {
72
82
$argument = $arguments->getNode($index);
73
-
if (!$argumentinstanceof \Twig_Node_Expression_Constant) {
83
+
if (!$this->checkNodeIsConstant($argument)) {
74
84
return$node;
75
-
// FIXME: Throw exception if there is some way for the user to turn this off
76
-
// on a case-by-case basis, similar to @Ignore in PHP
77
85
}
78
86
79
87
$domain = $argument->getAttribute('value');
@@ -153,4 +161,35 @@ public function leaveNode(\Twig_NodeInterface $node, \Twig_Environment $env)
0 commit comments