@@ -913,10 +913,7 @@ public function shiftArray(): Type
913
913
914
914
public function shuffleArray (): Type
915
915
{
916
- $ builder = ConstantArrayTypeBuilder::createFromConstantArray ($ this ->getValuesArray ());
917
- $ builder ->degradeToGeneralArray ();
918
-
919
- return $ builder ->getArray ();
916
+ return $ this ->getValuesArray ()->degradeToGeneralArray ();
920
917
}
921
918
922
919
public function sliceArray (Type $ offsetType , Type $ lengthType , TrinaryLogic $ preserveKeys ): Type
@@ -937,10 +934,7 @@ public function sliceArray(Type $offsetType, Type $lengthType, TrinaryLogic $pre
937
934
}
938
935
939
936
if ($ offset === null || $ length === null ) {
940
- $ builder = ConstantArrayTypeBuilder::createFromConstantArray ($ this );
941
- $ builder ->degradeToGeneralArray ();
942
-
943
- return $ builder ->getArray ()
937
+ return $ this ->degradeToGeneralArray ()
944
938
->sliceArray ($ offsetType , $ lengthType , $ preserveKeys );
945
939
}
946
940
@@ -1252,6 +1246,14 @@ public function generalizeValues(): self
1252
1246
return new self ($ this ->keyTypes , $ valueTypes , $ this ->nextAutoIndexes , $ this ->optionalKeys , $ this ->isList );
1253
1247
}
1254
1248
1249
+ private function degradeToGeneralArray (): Type
1250
+ {
1251
+ $ builder = ConstantArrayTypeBuilder::createFromConstantArray ($ this );
1252
+ $ builder ->degradeToGeneralArray ();
1253
+
1254
+ return $ builder ->getArray ();
1255
+ }
1256
+
1255
1257
public function getKeysArray (): self
1256
1258
{
1257
1259
return $ this ->getKeysOrValuesArray ($ this ->keyTypes );
0 commit comments