Skip to content

Commit 6642e34

Browse files
committed
FNSR - fix treatPhpDocTypesAsCertain: false
1 parent 9efef74 commit 6642e34

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

src/Analyser/Fiber/FiberScope.php

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ public function getType(Expr $node): Type
4646
new BeforeScopeForExprRequest($node, $this),
4747
);
4848

49-
return $beforeScope->toMutatingScope()->getType($node);
49+
$scope = $beforeScope->toMutatingScope();
50+
if ($this->nativeTypesPromoted) {
51+
$scope = $scope->doNotTreatPhpDocTypesAsCertain();
52+
}
53+
54+
return $scope->getType($node);
5055
}
5156

5257
public function getScopeType(Expr $expr): Type
@@ -67,7 +72,12 @@ public function getNativeType(Expr $expr): Type
6772
new BeforeScopeForExprRequest($expr, $this),
6873
);
6974

70-
return $beforeScope->toMutatingScope()->getNativeType($expr);
75+
$scope = $beforeScope->toMutatingScope();
76+
if ($this->nativeTypesPromoted) {
77+
$scope = $scope->doNotTreatPhpDocTypesAsCertain();
78+
}
79+
80+
return $scope->getNativeType($expr);
7181
}
7282

7383
public function getKeepVoidType(Expr $node): Type
@@ -77,7 +87,12 @@ public function getKeepVoidType(Expr $node): Type
7787
new BeforeScopeForExprRequest($node, $this),
7888
);
7989

80-
return $beforeScope->toMutatingScope()->getKeepVoidType($node);
90+
$scope = $beforeScope->toMutatingScope();
91+
if ($this->nativeTypesPromoted) {
92+
$scope = $scope->doNotTreatPhpDocTypesAsCertain();
93+
}
94+
95+
return $scope->getKeepVoidType($node);
8196
}
8297

8398
}

0 commit comments

Comments
 (0)