Bug report
I was trying to solve a PHPStan error in my code, where I had to remap a type of an optional array key.
I used if (isset($a['key'])) { ... } to catch the case and completely rewrite that value, but PHPStan still considers the "bad" value a possible type for key.
Code snippet that reproduces the problem
https://phpstan.org/r/c29618f1-5aa6-4295-b15f-b9382d014620
Expected output
I would expect no error, since string should no longer be a possible type after the if
Did PHPStan help you today? Did it make you happy in any way?
Totally! It's guiding me through a heavy refactoring!
Bug report
I was trying to solve a PHPStan error in my code, where I had to remap a type of an optional array key.
I used
if (isset($a['key'])) { ... }to catch the case and completely rewrite that value, but PHPStan still considers the "bad" value a possible type forkey.Code snippet that reproduces the problem
https://phpstan.org/r/c29618f1-5aa6-4295-b15f-b9382d014620
Expected output
I would expect no error, since
stringshould no longer be a possible type after theifDid PHPStan help you today? Did it make you happy in any way?
Totally! It's guiding me through a heavy refactoring!