Skip to content

Commit 7869053

Browse files
committed
Fix
1 parent 5d2512a commit 7869053

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Analyser/NodeScopeResolver.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -5079,10 +5079,10 @@ private function processAssignVar(
50795079

50805080
$valueToWrite = $this->produceArrayDimFetchAssignValueToWrite($offsetTypes, $offsetValueType, $valueToWrite);
50815081

5082-
$nativeValueToWrite = $valueToWrite;
50835082
if (!$offsetValueType->equals($offsetNativeValueType) || !$valueToWrite->equals($nativeValueToWrite)) {
50845083
$nativeValueToWrite = $this->produceArrayDimFetchAssignValueToWrite($offsetNativeTypes, $offsetNativeValueType, $nativeValueToWrite);
50855084
} else {
5085+
$rewritten = false;
50865086
foreach ($offsetTypes as $i => $offsetType) {
50875087
$offsetNativeType = $offsetNativeTypes[$i];
50885088
if ($offsetType === null) {
@@ -5099,8 +5099,13 @@ private function processAssignVar(
50995099
}
51005100

51015101
$nativeValueToWrite = $this->produceArrayDimFetchAssignValueToWrite($offsetNativeTypes, $offsetNativeValueType, $nativeValueToWrite);
5102+
$rewritten = true;
51025103
break;
51035104
}
5105+
5106+
if (!$rewritten) {
5107+
$nativeValueToWrite = $valueToWrite;
5108+
}
51045109
}
51055110

51065111
if ($varType->isArray()->yes() || !(new ObjectType(ArrayAccess::class))->isSuperTypeOf($varType)->yes()) {

0 commit comments

Comments
 (0)