Skip to content

Commit b53a9be

Browse files
Add defined check
1 parent 52b111a commit b53a9be

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

+6-3
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,12 @@ private function getReadDomainFromNode(Node $node): ?string
164164
) {
165165
$nodeArguments = $node->getNode('arguments');
166166
if ($nodeArguments->getIterator()->current() instanceof ConstantExpression) {
167-
$value = \constant($nodeArguments->getIterator()->current()->getAttribute('value'));
168-
if (\is_string($value)) {
169-
return $value;
167+
$constantName = $nodeArguments->getIterator()->current()->getAttribute('value');
168+
if (\defined($constantName)) {
169+
$value = \constant($constantName);
170+
if (\is_string($value)) {
171+
return $value;
172+
}
170173
}
171174
}
172175
}

0 commit comments

Comments
 (0)