vimeo / psalm

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

Invalid offset typehints #7589

Open jack-worman opened 2 years ago

jack-worman commented 2 years ago

https://psalm.dev/r/500481d28d

Psalm will put impossible type-hints for an array's offset.

psalm-github-bot[bot] commented 2 years ago

I found these snippets:

https://psalm.dev/r/500481d28d ```php INFO: UnusedVariable - 6:1 - $array is never referenced or the value is not used ```
AndrolGenhald commented 2 years ago

Less noise: https://psalm.dev/r/ccbb04c9ee

It looks like if the offset is possibly valid, Psalm fails to issue PossiblyInvalidArrayOffset.

psalm-github-bot[bot] commented 2 years ago

I found these snippets:

https://psalm.dev/r/ccbb04c9ee ```php