File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ class ConstantArrayType implements Type
8484
8585 private const DESCRIBE_LIMIT = 8 ;
8686 private const CHUNK_FINITE_TYPES_LIMIT = 5 ;
87+ private const OPTIONAL_KEYS_POWER_SET_LIMIT = 10 ;
8788
8889 private TrinaryLogic $ isList ;
8990
@@ -232,7 +233,7 @@ public function getAllArrays(): array
232233 return $ this ->allArrays ;
233234 }
234235
235- if (count ($ this ->optionalKeys ) <= 10 ) {
236+ if (count ($ this ->optionalKeys ) <= self :: OPTIONAL_KEYS_POWER_SET_LIMIT ) {
236237 $ optionalKeysCombinations = $ this ->powerSet ($ this ->optionalKeys );
237238 } else {
238239 $ optionalKeysCombinations = [
Original file line number Diff line number Diff line change 2121final class TypeUtils
2222{
2323
24+ private const FLATTEN_CONSTANT_ARRAYS_LIMIT = 16384 ;
25+
2426 /**
2527 * @return list<ConstantIntegerType>
2628 */
@@ -157,7 +159,7 @@ public static function flattenTypes(Type $type): array
157159 foreach ($ constantArrays as $ constantArray ) {
158160 $ optionalCount = count ($ constantArray ->getOptionalKeys ());
159161 $ arrayCount = $ optionalCount <= 20 ? (1 << $ optionalCount ) : PHP_INT_MAX ;
160- if ($ arrayCount > 16384 || $ estimatedCount > 16384 / max ($ arrayCount , 1 )) {
162+ if ($ arrayCount > self :: FLATTEN_CONSTANT_ARRAYS_LIMIT || $ estimatedCount > self :: FLATTEN_CONSTANT_ARRAYS_LIMIT / max ($ arrayCount , 1 )) {
161163 $ bail = true ;
162164 break ;
163165 }
You can’t perform that action at this time.
0 commit comments