phpstan
phpstan copied to clipboard
Closure required to no return statement
Bug report
This problem has appeared in 1.11.2, I strongly suspect it's related to #11092. PHPStan now seems to be able to infer that the closure will never be used therefore I don't need a return statement in the closure. This warning seems to be thrown from level 3 upwards. Like the previously mentioned issue I don't know if this was intended or an unexpected side effect of changes.
Code snippet that reproduces the problem
https://phpstan.org/r/1351efe1-5369-4729-8d99-378fb98bed04
Expected output
No errors reported.
Did PHPStan help you today? Did it make you happy in any way?
Allows me to refactor with confidence.