Skip to content

Commit

Permalink
Limit size of ConstantArrayType coming from literal array
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed May 13, 2020
1 parent 9814ab0 commit 8527777
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Analyser/MutatingScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,9 @@ private function resolveType(Expr $node): Type

} elseif ($node instanceof Array_) {
$arrayBuilder = ConstantArrayTypeBuilder::createEmpty();
if (count($node->items) > 256) {
$arrayBuilder->degradeToGeneralArray();
}
foreach ($node->items as $arrayItem) {
if ($arrayItem === null) {
continue;
Expand Down

0 comments on commit 8527777

Please sign in to comment.