Skip to content

Commit 49d2aa6

Browse files
committed
IssetCheck - respect treatPhpDocTypesAsCertain in more places
1 parent 5b7a115 commit 49d2aa6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Rules/IssetCheck.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public function check(Expr $expr, Scope $scope, string $operatorDescription, cal
191191
return null;
192192
}
193193

194-
$error = $this->generateError($scope->getType($expr), sprintf('Expression %s', $operatorDescription), $typeMessageCallback);
194+
$error = $this->generateError($this->treatPhpDocTypesAsCertain ? $scope->getType($expr) : $scope->getNativeType($expr), sprintf('Expression %s', $operatorDescription), $typeMessageCallback);
195195
if ($error !== null) {
196196
return $error;
197197
}
@@ -223,8 +223,8 @@ private function checkUndefined(Expr $expr, Scope $scope, string $operatorDescri
223223
}
224224

225225
if ($expr instanceof Node\Expr\ArrayDimFetch && $expr->dim !== null) {
226-
$type = $scope->getType($expr->var);
227-
$dimType = $scope->getType($expr->dim);
226+
$type = $this->treatPhpDocTypesAsCertain ? $scope->getType($expr->var) : $scope->getNativeType($expr->var);
227+
$dimType = $this->treatPhpDocTypesAsCertain ? $scope->getType($expr->dim) : $scope->getNativeType($expr->dim);
228228
$hasOffsetValue = $type->hasOffsetValueType($dimType);
229229
if (!$type->isOffsetAccessible()->yes()) {
230230
return $this->checkUndefined($expr->var, $scope, $operatorDescription);

0 commit comments

Comments
 (0)