vimeo / psalm

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

False positive ArgumentTypeCoercion with intersection types of closure arguments #11032

Open blackwolf12333 opened 1 week ago

blackwolf12333 commented 1 week ago

I expected the below to typecheck but it errors

https://psalm.dev/r/5428c288c8

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

I found these snippets:

https://psalm.dev/r/5428c288c8 ```php !!$item); ``` ``` Psalm output (using commit 16b24bd): ERROR: ArgumentTypeCoercion - 17:14 - Argument 1 of takesClosure expects pure-Closure(HasAncestor&Item):true, but parent type pure-Closure(TestItem1):true provided ```