-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
phpstan/phpstan-src
#4399Labels
Description
Bug report
I'm investigating
#4809
#6508
#7000
and splitting them into smaller related issues.
If I union two optional keyed constant arrays array{foo?: string, bar: string}|array{foo: string, bar?: string} PHPStan generalize it as array{foo?: string, bar?: string}&non-empty-array (which I think is a correct and smart behavior) but this make it not report an error on offset access on both optional keys.
Code snippet that reproduces the problem
https://phpstan.org/r/519053c6-5183-449b-91ae-b27661281395
Expected output
Report for maybe not existing offset access in line 8,9,17,18
Did PHPStan help you today? Did it make you happy in any way?
Yes! It' definitely a great tool already, and want to help making it even better!
Reactions are currently unavailable