vimeo / psalm

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

Self-referencing closures warn about unused variable #5003

Open ciaranmcnulty opened 3 years ago

ciaranmcnulty commented 3 years ago

https://psalm.dev/r/34dab8ef7f

In this case $fac is assigned to in the parent scope in order to be usable inside the closure, the fact it isn't referenced again in that parent scope is not an issue IMO

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

I found these snippets:

https://psalm.dev/r/34dab8ef7f ```php
weirdan commented 3 years ago

Yeah, I believe this should be made an exception.