You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In php8, the new null safe operator ?-> was added. When using it in combination with ?? for calling method/accesing properties on values of array like this:
($array['key'] ?? null)?->bar
phpstan incorrectly reports
Cannot access property $bar on T|null.
even though we are using the null safe operator, and the code behaves as expected (return nulls, when the key in the array does not exist).
Bug report
In php8, the new null safe operator
?->
was added. When using it in combination with??
for calling method/accesing properties on values of array like this:phpstan incorrectly reports
even though we are using the null safe operator, and the code behaves as expected (return nulls, when the key in the array does not exist).
Code snippet that reproduces the problem
https://phpstan.org/r/d831442b-e70b-48eb-b8ac-d68332590815
Expected output
To not report any errors
The text was updated successfully, but these errors were encountered: