Skip to content

Commit 0df0c6f

Browse files
committed
Filter scope by dynamic variable name for $$name
1 parent 8bb0670 commit 0df0c6f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Analyser/MutatingScope.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2010,7 +2010,11 @@ static function (Node $node, Scope $scope) use ($arrowScope, &$arrowFunctionImpu
20102010

20112011
$nameType = $this->getType($node->name);
20122012
if (count($nameType->getConstantStrings()) > 0) {
2013-
return TypeCombinator::union(...array_map(fn ($constantString) => $this->getVariableType($constantString->getValue()), $nameType->getConstantStrings()));
2013+
return TypeCombinator::union(
2014+
...array_map(fn ($constantString) => $this
2015+
->filterByTruthyValue(new BinaryOp\Identical($node->name, new String_($constantString->getValue())))
2016+
->getVariableType($constantString->getValue()), $nameType->getConstantStrings()),
2017+
);
20142018
}
20152019
}
20162020

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy