@@ -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
@@ -1262,6 +1256,14 @@ public function generalizeValues(): self
1262
1256
return new self ($ this ->keyTypes , $ valueTypes , $ this ->nextAutoIndexes , $ this ->optionalKeys , $ this ->isList );
1263
1257
}
1264
1258
1259
+ private function degradeToGeneralArray (): Type
1260
+ {
1261
+ $ builder = ConstantArrayTypeBuilder::createFromConstantArray ($ this );
1262
+ $ builder ->degradeToGeneralArray ();
1263
+
1264
+ return $ builder ->getArray ();
1265
+ }
1266
+
1265
1267
public function getKeysArray (): self
1266
1268
{
1267
1269
return $ this ->getKeysOrValuesArray ($ this ->keyTypes );
0 commit comments