Skip to content

Commit 9c7a3e4

Browse files
committed
fix
1 parent fd70215 commit 9c7a3e4

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/Analyser/ExprHandler/AssignHandler.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,15 @@ private function produceArrayDimFetchAssignValueToWrite(array $dimFetchStack, ar
10161016
$unionValues = false;
10171017
if ($i === 0) {
10181018
$unionValues = true;
1019-
} elseif ($overwrites === true && $i === count($offsetTypes) - 1) {
1019+
} elseif (
1020+
$overwrites === true
1021+
&& $i === count($offsetTypes) - 1
1022+
&&
1023+
(
1024+
$originalValueToWrite->isConstantScalarValue()->yes()
1025+
|| !$offsetValueType->getIterableValueType()->isSuperTypeOf($valueToWrite)->yes()
1026+
)
1027+
) {
10201028
$unionValues = true;
10211029
}
10221030

0 commit comments

Comments
 (0)