-
-
Notifications
You must be signed in to change notification settings - Fork 864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False positive with isset on nullable object's array property key #1884
Comments
This is a feature. With So the code |
I understand. Should |
Yeah, probably. |
Fixed by: phpstan/phpstan-src#345 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary of a problem or a feature request
Checking a nullable object's array property key with
isset()
yields the following error:Code snippet that reproduces the problem
https://phpstan.org/r/7ec5332d-70c0-4307-aa4e-b28b69d712d4
Expected output
No errors.
If
$nullableObject
isNULL
,isset()
returnsFALSE
without any errors.Changing the condition to
isset($nullableObject) && isset($nullableObject->arrayProperty['key'])
works, but it's a pointless extra check I'd rather avoid 🙂The text was updated successfully, but these errors were encountered: