@@ -919,10 +919,7 @@ public function shiftArray(): Type
919
919
920
920
public function shuffleArray (): Type
921
921
{
922
- $ builder = ConstantArrayTypeBuilder::createFromConstantArray ($ this ->getValuesArray ());
923
- $ builder ->degradeToGeneralArray ();
924
-
925
- return $ builder ->getArray ();
922
+ return $ this ->getValuesArray ()->degradeToGeneralArray ();
926
923
}
927
924
928
925
public function sliceArray (Type $ offsetType , Type $ lengthType , TrinaryLogic $ preserveKeys ): Type
@@ -943,10 +940,7 @@ public function sliceArray(Type $offsetType, Type $lengthType, TrinaryLogic $pre
943
940
}
944
941
945
942
if ($ offset === null || $ length === null ) {
946
- $ builder = ConstantArrayTypeBuilder::createFromConstantArray ($ this );
947
- $ builder ->degradeToGeneralArray ();
948
-
949
- return $ builder ->getArray ()
943
+ return $ this ->degradeToGeneralArray ()
950
944
->sliceArray ($ offsetType , $ lengthType , $ preserveKeys );
951
945
}
952
946
@@ -1268,6 +1262,14 @@ public function generalizeValues(): self
1268
1262
return new self ($ this ->keyTypes , $ valueTypes , $ this ->nextAutoIndexes , $ this ->optionalKeys , $ this ->isList );
1269
1263
}
1270
1264
1265
+ private function degradeToGeneralArray (): Type
1266
+ {
1267
+ $ builder = ConstantArrayTypeBuilder::createFromConstantArray ($ this );
1268
+ $ builder ->degradeToGeneralArray ();
1269
+
1270
+ return $ builder ->getArray ();
1271
+ }
1272
+
1271
1273
public function getKeysArray (): self
1272
1274
{
1273
1275
return $ this ->getKeysOrValuesArray ($ this ->keyTypes );
0 commit comments