Skip to content

Commit 34fb83d

Browse files
committed
Revert "processAssignVar optimization for arrays"
This reverts commit 5d2b6244dd2e17fb078037b56a91cf3982e974ea.
1 parent 61c1c85 commit 34fb83d

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

src/Analyser/NodeScopeResolver.php

+1-24
Original file line numberDiff line numberDiff line change
@@ -5078,30 +5078,7 @@ private function processAssignVar(
50785078
$offsetNativeValueType = $varNativeType;
50795079

50805080
$valueToWrite = $this->produceArrayDimFetchAssignValueToWrite($offsetTypes, $offsetValueType, $valueToWrite);
5081-
5082-
$nativeValueToWrite = $valueToWrite;
5083-
if (!$offsetValueType->equals($offsetNativeValueType) || !$valueToWrite->equals($nativeValueToWrite)) {
5084-
$nativeValueToWrite = $this->produceArrayDimFetchAssignValueToWrite($offsetNativeTypes, $offsetNativeValueType, $nativeValueToWrite);
5085-
} else {
5086-
foreach ($offsetTypes as $i => $offsetType) {
5087-
$offsetNativeType = $offsetNativeTypes[$i];
5088-
if ($offsetType === null) {
5089-
if ($offsetNativeType !== null) {
5090-
throw new ShouldNotHappenException();
5091-
}
5092-
5093-
continue;
5094-
} elseif ($offsetNativeType === null) {
5095-
throw new ShouldNotHappenException();
5096-
}
5097-
if ($offsetType->equals($offsetNativeType)) {
5098-
continue;
5099-
}
5100-
5101-
$nativeValueToWrite = $this->produceArrayDimFetchAssignValueToWrite($offsetNativeTypes, $offsetNativeValueType, $nativeValueToWrite);
5102-
break;
5103-
}
5104-
}
5081+
$nativeValueToWrite = $this->produceArrayDimFetchAssignValueToWrite($offsetNativeTypes, $offsetNativeValueType, $nativeValueToWrite);
51055082

51065083
if ($varType->isArray()->yes() || !(new ObjectType(ArrayAccess::class))->isSuperTypeOf($varType)->yes()) {
51075084
if ($var instanceof Variable && is_string($var->name)) {

0 commit comments

Comments
 (0)