File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -5078,7 +5078,30 @@ private function processAssignVar(
50785078$ offsetNativeValueType = $ varNativeType ;
50795079
50805080$ valueToWrite = $ this ->produceArrayDimFetchAssignValueToWrite ($ offsetTypes , $ offsetValueType , $ valueToWrite );
5081- $ nativeValueToWrite = $ this ->produceArrayDimFetchAssignValueToWrite ($ offsetNativeTypes , $ offsetNativeValueType , $ nativeValueToWrite );
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+ }
50825105
50835106if ($ varType ->isArray ()->yes () || !(new ObjectType (ArrayAccess::class))->isSuperTypeOf ($ varType )->yes ()) {
50845107if ($ var instanceof Variable && is_string ($ var ->name )) {
You can’t perform that action at this time.
0 commit comments