@@ -5384,12 +5384,12 @@ private function processAssignVar(
53845384 }
53855385
53865386 if ($ dimExpr === null ) {
5387- $ offsetTypes [] = null ;
5388- $ offsetNativeTypes [] = null ;
5387+ $ offsetTypes [] = [ null , TrinaryLogic:: createYes ()] ;
5388+ $ offsetNativeTypes [] = [ null , TrinaryLogic:: createYes ()] ;
53895389
53905390 } else {
5391- $ offsetTypes [] = $ scope ->getType ($ dimExpr );
5392- $ offsetNativeTypes [] = $ scope ->getNativeType ($ dimExpr );
5391+ $ offsetTypes [] = [ $ scope ->getType ($ dimExpr ), $ scope -> getType ( $ dimFetch -> var )-> hasOffsetValueType ( $ scope -> getType ( $ dimExpr ))-> or ( $ scope -> hasExpressionType ( $ dimFetch ))] ;
5392+ $ offsetNativeTypes [] = [ $ scope ->getNativeType ($ dimExpr ), $ scope -> getNativeType ( $ dimFetch -> var )-> hasOffsetValueType ( $ scope -> getNativeType ( $ dimExpr ))-> or ( $ scope -> hasExpressionType ( $ dimFetch ))] ;
53935393
53945394 if ($ enterExpressionAssign ) {
53955395 $ scope ->enterExpressionAssign ($ dimExpr );
@@ -5436,8 +5436,8 @@ private function processAssignVar(
54365436 $ nativeValueToWrite = $ this ->produceArrayDimFetchAssignValueToWrite ($ offsetNativeTypes , $ offsetNativeValueType , $ nativeValueToWrite );
54375437 } else {
54385438 $ rewritten = false ;
5439- foreach ($ offsetTypes as $ i => $ offsetType ) {
5440- $ offsetNativeType = $ offsetNativeTypes [$ i ];
5439+ foreach ($ offsetTypes as $ i => [ $ offsetType] ) {
5440+ [ $ offsetNativeType] = $ offsetNativeTypes [$ i ];
54415441 if ($ offsetType === null ) {
54425442 if ($ offsetNativeType !== null ) {
54435443 throw new ShouldNotHappenException ();
@@ -5752,18 +5752,16 @@ static function (): void {
57525752 }
57535753
57545754 /**
5755- * @param list<Type|null> $offsetTypes
5755+ * @param list<array{ Type|null, TrinaryLogic} > $offsetTypes
57565756 */
57575757 private function produceArrayDimFetchAssignValueToWrite (array $ offsetTypes , Type $ offsetValueType , Type $ valueToWrite ): Type
57585758 {
57595759 $ offsetValueTypeStack = [[$ offsetValueType , TrinaryLogic::createYes ()]];
5760- foreach (array_slice ($ offsetTypes , 0 , -1 ) as $ offsetType ) {
5760+ foreach (array_slice ($ offsetTypes , 0 , -1 ) as [ $ offsetType, $ has ] ) {
57615761 if ($ offsetType === null ) {
5762- $ has = TrinaryLogic::createYes ();
57635762 $ offsetValueType = new ConstantArrayType ([], []);
57645763
57655764 } else {
5766- $ has = $ offsetValueType ->hasOffsetValueType ($ offsetType );
57675765 $ offsetValueType = $ offsetValueType ->getOffsetValueType ($ offsetType );
57685766 if ($ offsetValueType instanceof ErrorType) {
57695767 $ offsetValueType = new ConstantArrayType ([], []);
@@ -5773,7 +5771,7 @@ private function produceArrayDimFetchAssignValueToWrite(array $offsetTypes, Type
57735771 $ offsetValueTypeStack [] = [$ offsetValueType , $ has ];
57745772 }
57755773
5776- foreach (array_reverse ($ offsetTypes ) as $ i => $ offsetType ) {
5774+ foreach (array_reverse ($ offsetTypes ) as $ i => [ $ offsetType] ) {
57775775 /** @var Type $offsetValueType */
57785776 [$ offsetValueType , $ has ] = array_pop ($ offsetValueTypeStack );
57795777 if (
0 commit comments