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
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.
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 asarray{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!
The text was updated successfully, but these errors were encountered: