This RFC proposes a way to have multi-line short closures — closures that don't need explicit
use statements, but can still have multiple lines and a return statement.
Best of both worlds (auto-capture + ability to build return value using intermediate variables).
Callbacks are the bread-and-butter of any modern PHP developer, so being able to trim down the cruft to make code more consise and readable is a no-brain win.
When using utility functions that expect callable/Closure as parameters you are currently forced to bring over all required variables with the use statement. Depending on context that can be a lot of variables and any time the code changes you need to keep track of that list of variables.
Having used short closures for a while now they feel really good.
I think the proposition is not "must have" option but it's ok
the biggest advantage for me is that you then need to use the
use keyword when you need data from outside.
Just use "fn" everywhere my fingers hurt from typing "uction" all the time.
Multi lines short closures with arrow function? What we're missing!
It makes my code much clearly
since we are moving in the c# direction, why not take a really good thing they do
That's a very good idea. More convenient than using
I don't see a reason for not implementing this. It would make writing closures much more easy and natural.
it will increase code readability to sky)
Just for the sake of code readability improvements & not needing to use the use keyword, It has my full support. Other languages have solved the issue, why not PHP aswell?
use(...) can be shortened easily.