@@ -919,10 +919,7 @@ public function shiftArray(): Type
919919
920920 public function shuffleArray (): Type
921921 {
922- $ builder = ConstantArrayTypeBuilder::createFromConstantArray ($ this ->getValuesArray ());
923- $ builder ->degradeToGeneralArray ();
924-
925- return $ builder ->getArray ();
922+ return $ this ->getValuesArray ()->degradeToGeneralArray ();
926923 }
927924
928925 public function sliceArray (Type $ offsetType , Type $ lengthType , TrinaryLogic $ preserveKeys ): Type
@@ -943,10 +940,7 @@ public function sliceArray(Type $offsetType, Type $lengthType, TrinaryLogic $pre
943940 }
944941
945942 if ($ offset === null || $ length === null ) {
946- $ builder = ConstantArrayTypeBuilder::createFromConstantArray ($ this );
947- $ builder ->degradeToGeneralArray ();
948-
949- return $ builder ->getArray ()
943+ return $ this ->degradeToGeneralArray ()
950944 ->sliceArray ($ offsetType , $ lengthType , $ preserveKeys );
951945 }
952946
@@ -1268,6 +1262,14 @@ public function generalizeValues(): self
12681262 return new self ($ this ->keyTypes , $ valueTypes , $ this ->nextAutoIndexes , $ this ->optionalKeys , $ this ->isList );
12691263 }
12701264
1265+ private function degradeToGeneralArray (): Type
1266+ {
1267+ $ builder = ConstantArrayTypeBuilder::createFromConstantArray ($ this );
1268+ $ builder ->degradeToGeneralArray ();
1269+
1270+ return $ builder ->getArray ();
1271+ }
1272+
12711273 public function getKeysArray (): self
12721274 {
12731275 return $ this ->getKeysOrValuesArray ($ this ->keyTypes );
0 commit comments