Skip to content

Commit 929a40d

Browse files
phpstan-botclaude
andcommitted
Rename hasOverflowingHasOffsetValueTypes to isLargeUnionType
The previous name was misleading: it suggested counting HasOffsetValueType members specifically, but it actually checks whether the union type has too many members overall. Rename the method and constant to accurately reflect what they check. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 735e870 commit 929a40d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/Analyser/MutatingScope.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class MutatingScope implements Scope, NodeCallbackInvoker
138138

139139
public const KEEP_VOID_ATTRIBUTE_NAME = 'keepVoid';
140140
private const CONTAINS_SUPER_GLOBAL_ATTRIBUTE_NAME = 'containsSuperGlobal';
141-
private const ARRAY_DIM_FETCH_UNION_HAS_OFFSET_VALUE_TYPE_LIMIT = 16;
141+
private const ARRAY_DIM_FETCH_UNION_MEMBER_LIMIT = 16;
142142

143143
/** @var Type[] */
144144
private array $resolvedTypes = [];
@@ -2744,7 +2744,7 @@ public function specifyExpressionType(Expr $expr, Type $type, Type $nativeType,
27442744
}
27452745

27462746
if ($dimType instanceof ConstantIntegerType || $dimType instanceof ConstantStringType) {
2747-
if (!$this->hasOverflowingHasOffsetValueTypes($exprVarType)) {
2747+
if (!$this->isLargeUnionType($exprVarType)) {
27482748
$varType = TypeCombinator::intersect(
27492749
$varType,
27502750
new HasOffsetValueType($dimType, $type),
@@ -2798,13 +2798,13 @@ public function specifyExpressionType(Expr $expr, Type $type, Type $nativeType,
27982798
return $scope;
27992799
}
28002800

2801-
private function hasOverflowingHasOffsetValueTypes(Type $type): bool
2801+
private function isLargeUnionType(Type $type): bool
28022802
{
28032803
if (!$type instanceof UnionType) {
28042804
return false;
28052805
}
28062806

2807-
return count($type->getTypes()) > self::ARRAY_DIM_FETCH_UNION_HAS_OFFSET_VALUE_TYPE_LIMIT;
2807+
return count($type->getTypes()) > self::ARRAY_DIM_FETCH_UNION_MEMBER_LIMIT;
28082808
}
28092809

28102810
public function assignExpression(Expr $expr, Type $type, Type $nativeType): self

0 commit comments

Comments
 (0)