Skip to content

Commit

Permalink
Microoptimization
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Aug 18, 2021
1 parent 502596f commit 66fb725
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Type/ConstantTypeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public static function getTypeFromValue($value): Type
return new ConstantStringType($value);
} elseif (is_array($value)) {
$arrayBuilder = ConstantArrayTypeBuilder::createEmpty();
if (count($value) > 256) {
$arrayBuilder->degradeToGeneralArray();
}
foreach ($value as $k => $v) {
$arrayBuilder->setOffsetValueType(self::getTypeFromValue($k), self::getTypeFromValue($v));
}
Expand Down

0 comments on commit 66fb725

Please sign in to comment.