Skip to content

Commit 707cfb2

Browse files
committed
Constants
1 parent 30c9b01 commit 707cfb2

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/Analyser/MutatingScope.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,7 @@ private function resolveType(Expr $node): Type
16091609

16101610
} elseif ($node instanceof Array_) {
16111611
$arrayBuilder = ConstantArrayTypeBuilder::createEmpty();
1612-
if (count($node->items) > 256) {
1612+
if (count($node->items) > ConstantArrayTypeBuilder::ARRAY_COUNT_LIMIT) {
16131613
$arrayBuilder->degradeToGeneralArray();
16141614
}
16151615
foreach ($node->items as $arrayItem) {

src/Type/Constant/ConstantArrayTypeBuilder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
class ConstantArrayTypeBuilder
1515
{
1616

17+
public const ARRAY_COUNT_LIMIT = 256;
18+
1719
/** @var array<int, Type> */
1820
private array $keyTypes;
1921

src/Type/ConstantTypeHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static function getTypeFromValue($value): Type
3232
return new ConstantStringType($value);
3333
} elseif (is_array($value)) {
3434
$arrayBuilder = ConstantArrayTypeBuilder::createEmpty();
35-
if (count($value) > 256) {
35+
if (count($value) > ConstantArrayTypeBuilder::ARRAY_COUNT_LIMIT) {
3636
$arrayBuilder->degradeToGeneralArray();
3737
}
3838
foreach ($value as $k => $v) {

0 commit comments

Comments
 (0)