Skip to content

Commit

Permalink
IssetCheck - respect treatPhpDocTypesAsCertain in more places
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Apr 1, 2023
1 parent 5b7a115 commit 49d2aa6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Rules/IssetCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function check(Expr $expr, Scope $scope, string $operatorDescription, cal
return null;
}

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

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

0 comments on commit 49d2aa6

Please sign in to comment.