vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.54k stars 660 forks source link

PHP native "array_is_list" adds incorrect "mixed" type #9078

Open kkmuffme opened 1 year ago

kkmuffme commented 1 year ago

https://psalm.dev/r/1152211845 https://psalm.dev/r/77fd9de1e7

Why does it suddenly add "mixed" in the else case?

psalm-github-bot[bot] commented 1 year ago

I found these snippets:

https://psalm.dev/r/1152211845 ```php $bar */ $foo = $bar; /** @psalm-trace $foo */; if (array_is_list($foo)) { /** @psalm-trace $foo */; } else { /** @psalm-trace $foo */; } ``` ``` Psalm output (using commit 1350992): INFO: Trace - 8:25 - $foo: array INFO: Trace - 11:29 - $foo: list INFO: Trace - 13:29 - $foo: array ```
https://psalm.dev/r/77fd9de1e7 ```php INFO: Trace - 6:29 - $foo: list{'hello', 'world'} INFO: Trace - 8:29 - $foo: list{0?: 'hello'|mixed, 1?: 'world'|mixed, ..., mixed>} ```
orklah commented 1 year ago

ping @danog