phpstan
phpstan copied to clipboard
Optional keys in nested object shapes ($A->B->C ?? [])
Bug report
Thank you for releasing 1.10.51 :tada:
Object shapes with optional keys now work with coalescing, but this does not work fully if multiple objects are nested.
This is related to #10317 and #10327.
For context, I'm trying to add stubs to a mess of a library generated from a SOAP spec.
Code snippet that reproduces the problem
https://phpstan.org/r/d8d7859d-6942-4f9d-940e-05ed7b14680d
Expected output
-
Using nullsafe property access "?->Monkey" on left side of ?? is unnecessary. Use -> instead.
is correct; -
Access to an undefined property object{Monkey?: array<int>}::$Monkey.
is not correct;
Did PHPStan help you today? Did it make you happy in any way?
No response