Skip to content

Commit 8bc697f

Browse files
committed
try specifying AST certainty in scope
1 parent 37d5313 commit 8bc697f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/Analyser/NodeScopeResolver.php

+20
Original file line numberDiff line numberDiff line change
@@ -5489,6 +5489,26 @@ private function processAssignVar(
54895489
);
54905490
}
54915491
}
5492+
5493+
$arrayDimFetchVar = $originalVar;
5494+
while ($arrayDimFetchVar instanceof ArrayDimFetch) {
5495+
$dimExpr = $arrayDimFetchVar->dim;
5496+
if ($dimExpr === null) {
5497+
$arrayDimFetchVar = $arrayDimFetchVar->var;
5498+
continue;
5499+
}
5500+
5501+
$dimVar = $arrayDimFetchVar->var;
5502+
$dimVarType = $scope->getType($dimVar);
5503+
$dimDimType = $scope->getType($dimExpr);
5504+
if ($dimVarType->hasOffsetValueType($dimDimType)->yes()) {
5505+
$arrayDimFetchVar = $arrayDimFetchVar->var;
5506+
continue;
5507+
}
5508+
5509+
$scope = $scope->specifyExpressionType($arrayDimFetchVar, $scope->getType($arrayDimFetchVar), $scope->getNativeType($arrayDimFetchVar), TrinaryLogic::createYes());
5510+
$arrayDimFetchVar = $arrayDimFetchVar->var;
5511+
}
54925512
} else {
54935513
if ($var instanceof Variable) {
54945514
$nodeCallback(new VariableAssignNode($var, $assignedPropertyExpr, $isAssignOp), $scope);

0 commit comments

Comments
 (0)