Skip to content

Commit fb95750

Browse files
committed
simplify
1 parent cd1ec83 commit fb95750

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/Analyser/ExprHandler/Helper/NonNullabilityHelper.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,7 @@ public function ensureShallowNonNullability(MutatingScope $scope, Scope $origina
5151
return new EnsuredNonNullabilityResult($scope, []);
5252
}
5353

54-
$nativeType = $scope->getNativeType($exprToSpecify);
55-
56-
$specifiedExpressions = [
57-
new EnsuredNonNullabilityResultExpression($exprToSpecify, $exprType, $nativeType, $certainty),
58-
];
54+
$specifiedExpressions = [];
5955

6056
// When narrowing an ArrayDimFetch, specifyExpressionType also recursively
6157
// narrows the parent array's offset type via intersection with HasOffsetValueType.
@@ -64,14 +60,16 @@ public function ensureShallowNonNullability(MutatingScope $scope, Scope $origina
6460
$parentExpr = $exprToSpecify->var;
6561
$hasParentExpressionType = $originalScope->hasExpressionType($parentExpr);
6662

67-
array_unshift($specifiedExpressions, new EnsuredNonNullabilityResultExpression(
63+
$specifiedExpressions[] = new EnsuredNonNullabilityResultExpression(
6864
$parentExpr,
6965
$scope->getType($parentExpr),
7066
$scope->getNativeType($parentExpr),
7167
$hasParentExpressionType,
72-
));
68+
);
7369
}
7470

71+
$nativeType = $scope->getNativeType($exprToSpecify);
72+
$specifiedExpressions[] = new EnsuredNonNullabilityResultExpression($exprToSpecify, $exprType, $nativeType, $certainty);
7573
$scope = $scope->specifyExpressionType(
7674
$exprToSpecify,
7775
$exprTypeWithoutNull,

0 commit comments

Comments
 (0)