-
-
Notifications
You must be signed in to change notification settings - Fork 934
Closed
phpstan/phpstan-src
#1223Labels
Milestone
Description
Bug report
According to the docs, $a ?? $b is functionally equivalent to isset($a) ? $a : $b. However, PHPstan seems to treat them differently.
Code snippet that reproduces the problem
See lines 14 (null coalescing) and 15 (isset) of the following:
https://phpstan.org/r/ff7c5d16-abb6-4445-b950-1799077559ce
An error is produced for line 14 (null coalescing):
Access to an undefined property object::$datalen
but not for line 15 (isset).
Expected output
No error should be produced for line 14.
Did PHPStan help you today? Did it make you happy in any way?
Yes.
pawel-baster, lukasz-pw and JakubOnderka