File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -742,7 +742,10 @@ public function unsetOffset(Type $offsetType): Type
742742 }
743743
744744 $ newIsList = TrinaryLogic::createNo ();
745- if (!$ this ->isList ->no ()) {
745+ // We're unsetting something that might not be on the array,
746+ // so it might still be a list (with PHPStan definition)
747+ // because the nextAutoIndexes will not change.
748+ if (!$ this ->isList ->no () && in_array ($ i , $ this ->optionalKeys , true )) {
746749 $ preserveIsList = true ;
747750 $ isListOnlyIfKeysAreOptional = false ;
748751 foreach ($ newKeyTypes as $ k2 => $ newKeyType2 ) {
@@ -765,7 +768,7 @@ public function unsetOffset(Type $offsetType): Type
765768 }
766769
767770 if ($ preserveIsList ) {
768- $ newIsList = $ this -> isList ;
771+ $ newIsList = TrinaryLogic:: createMaybe () ;
769772 }
770773 }
771774
You can’t perform that action at this time.
0 commit comments