@@ -913,10 +913,7 @@ public function shiftArray(): Type
913913
914914 public function shuffleArray (): Type
915915 {
916- $ builder = ConstantArrayTypeBuilder::createFromConstantArray ($ this ->getValuesArray ());
917- $ builder ->degradeToGeneralArray ();
918-
919- return $ builder ->getArray ();
916+ return $ this ->getValuesArray ()->degradeToGeneralArray ();
920917 }
921918
922919 public function sliceArray (Type $ offsetType , Type $ lengthType , TrinaryLogic $ preserveKeys ): Type
@@ -937,10 +934,7 @@ public function sliceArray(Type $offsetType, Type $lengthType, TrinaryLogic $pre
937934 }
938935
939936 if ($ offset === null || $ length === null ) {
940- $ builder = ConstantArrayTypeBuilder::createFromConstantArray ($ this );
941- $ builder ->degradeToGeneralArray ();
942-
943- return $ builder ->getArray ()
937+ return $ this ->degradeToGeneralArray ()
944938 ->sliceArray ($ offsetType , $ lengthType , $ preserveKeys );
945939 }
946940
@@ -1262,6 +1256,14 @@ public function generalizeValues(): self
12621256 return new self ($ this ->keyTypes , $ valueTypes , $ this ->nextAutoIndexes , $ this ->optionalKeys , $ this ->isList );
12631257 }
12641258
1259+ private function degradeToGeneralArray (): Type
1260+ {
1261+ $ builder = ConstantArrayTypeBuilder::createFromConstantArray ($ this );
1262+ $ builder ->degradeToGeneralArray ();
1263+
1264+ return $ builder ->getArray ();
1265+ }
1266+
12651267 public function getKeysArray (): self
12661268 {
12671269 return $ this ->getKeysOrValuesArray ($ this ->keyTypes );
0 commit comments