Skip to content

Commit 5b5ec27

Browse files
committed
simplify fix
1 parent 177cd03 commit 5b5ec27

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

src/Analyser/MutatingScope.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2692,30 +2692,28 @@ public function specifyExpressionType(Expr $expr, Type $type, Type $nativeType,
26922692
$isArray = $exprVarType->isArray();
26932693
if (!$exprVarType instanceof MixedType && !$isArray->no()) {
26942694
$varType = $exprVarType;
2695-
$tooComplex = $exprVarType instanceof UnionType && count($exprVarType->getTypes()) > self::ARRAY_DIM_FETCH_UNION_TYPE_LIMIT;
2696-
if (!$tooComplex && !$isArray->yes()) {
2695+
if (!$isArray->yes()) {
26972696
if ($dimType->isInteger()->yes()) {
26982697
$varType = TypeCombinator::intersect($exprVarType, StaticTypeFactory::intOffsetAccessibleType());
26992698
} else {
27002699
$varType = TypeCombinator::intersect($exprVarType, StaticTypeFactory::generalOffsetAccessibleType());
27012700
}
27022701
}
27032702

2703+
$tooComplex = $exprVarType instanceof UnionType && count($exprVarType->getTypes()) > self::ARRAY_DIM_FETCH_UNION_TYPE_LIMIT;
27042704
if (!$tooComplex && ($dimType instanceof ConstantIntegerType || $dimType instanceof ConstantStringType)) {
27052705
$varType = TypeCombinator::intersect(
27062706
$varType,
27072707
new HasOffsetValueType($dimType, $type),
27082708
);
27092709
}
27102710

2711-
if (!$tooComplex) {
2712-
$scope = $scope->specifyExpressionType(
2713-
$expr->var,
2714-
$varType,
2715-
$scope->getNativeType($expr->var),
2716-
$certainty,
2717-
);
2718-
}
2711+
$scope = $scope->specifyExpressionType(
2712+
$expr->var,
2713+
$varType,
2714+
$scope->getNativeType($expr->var),
2715+
$certainty,
2716+
);
27192717
}
27202718
}
27212719
}

0 commit comments

Comments
 (0)