Skip to content

Commit 2671bed

Browse files
committed
no need to set the attribute for non-global vars
1 parent 855de6a commit 2671bed

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Analyser/MutatingScope.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4172,7 +4172,9 @@ public function isUndefinedExpressionAllowed(Expr $expr): bool
41724172
public function assignVariable(string $variableName, Type $type, Type $nativeType, TrinaryLogic $certainty, bool $isGlobal = false): self
41734173
{
41744174
$node = new Variable($variableName);
4175-
$node->setAttribute(self::IS_GLOBAL_ATTRIBUTE_NAME, $isGlobal || $this->isGlobalVariable($variableName));
4175+
if ($isGlobal || $this->isGlobalVariable($variableName)) {
4176+
$node->setAttribute(self::IS_GLOBAL_ATTRIBUTE_NAME, true);
4177+
}
41764178

41774179
$scope = $this->assignExpression($node, $type, $nativeType);
41784180
if ($certainty->no()) {

0 commit comments

Comments
 (0)