-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
phpstan/phpstan-src
#4126Labels
Milestone
Description
Bug report
When a function or method returns an intersection of array and ArrayAccess with identical key and value types, access to that array will always return mixed, not the specified value type.
Even adding an isset check will only remove null from the possible options, but will still treat the value itself as mixed.
Code snippet that reproduces the problem
https://phpstan.org/r/3739dc63-7633-4d32-a148-098311748c40
Expected output
PHPStan incorrectly throws an error, where none should be.
Did PHPStan help you today? Did it make you happy in any way?
We are working on an old codebase. We've turned PHPstan up to level 10 using a big baseline, and as a way to unwind between regular features and issues, we just delete random rows from the baseline and fix them. Baby-steps toward a better codebase.
Reactions are currently unavailable