@@ -139,8 +139,6 @@ class MutatingScope implements Scope, NodeCallbackInvoker
139139 public const KEEP_VOID_ATTRIBUTE_NAME = 'keepVoid ' ;
140140 private const CONTAINS_SUPER_GLOBAL_ATTRIBUTE_NAME = 'containsSuperGlobal ' ;
141141
142- private const ARRAY_DIM_FETCH_UNION_HAS_OFFSET_VALUE_TYPE_LIMIT = 16 ;
143-
144142 /** @var Type[] */
145143 private array $ resolvedTypes = [];
146144
@@ -2732,39 +2730,16 @@ public function specifyExpressionType(Expr $expr, Type $type, Type $nativeType,
27322730 $ exprVarType = $ scope ->getType ($ expr ->var );
27332731 $ isArray = $ exprVarType ->isArray ();
27342732 if (!$ exprVarType instanceof MixedType && !$ isArray ->no ()) {
2735- $ tooManyHasOffsetValueTypes = false ;
2736-
27372733 $ varType = $ exprVarType ;
27382734 if (!$ isArray ->yes ()) {
27392735 if ($ dimType ->isInteger ()->yes ()) {
27402736 $ varType = TypeCombinator::intersect ($ exprVarType , StaticTypeFactory::intOffsetAccessibleType ());
27412737 } else {
27422738 $ varType = TypeCombinator::intersect ($ exprVarType , StaticTypeFactory::generalOffsetAccessibleType ());
27432739 }
2744-
2745- if ($ exprVarType instanceof UnionType) {
2746- $ hasOffsetAccessoryCount = 0 ;
2747- foreach ($ exprVarType ->getTypes () as $ innerType ) {
2748- foreach (TypeUtils::getAccessoryTypes ($ innerType ) as $ accessoryType ) {
2749- if (!($ accessoryType instanceof HasOffsetValueType)) {
2750- continue ;
2751- }
2752-
2753- $ hasOffsetAccessoryCount ++;
2754-
2755- if ($ hasOffsetAccessoryCount > self ::ARRAY_DIM_FETCH_UNION_HAS_OFFSET_VALUE_TYPE_LIMIT ) {
2756- $ tooManyHasOffsetValueTypes = true ;
2757- break 2 ;
2758- }
2759- }
2760- }
2761- }
27622740 }
27632741
2764- if (
2765- !$ tooManyHasOffsetValueTypes
2766- && ($ dimType instanceof ConstantIntegerType || $ dimType instanceof ConstantStringType)
2767- ) {
2742+ if ($ dimType instanceof ConstantIntegerType || $ dimType instanceof ConstantStringType) {
27682743 $ varType = TypeCombinator::intersect (
27692744 $ varType ,
27702745 new HasOffsetValueType ($ dimType , $ type ),
0 commit comments