Member since
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.
Makes code more clean because it is shorter and the use
keyword is not needed anymore.
I'm not sure if allowing default implementations in interfaces is the way to go here.
To me it looks like a workaround / hack for non existing multi inheritance.
Why not either make multi inheritance possible instead or allow traits with interfaces as suggested by Victor?
It looks pretty much the exact function as abstract class. I still think interfaces/contracts should not include any concrete implementation
We spend a lot more time reading code than writing it. The elegance of short closure combined with the convenience of variable scope usage has already shown to be a game changer on Typescript and there doesn’t seem to be any technical issue with having it on PHP.
At least once a week, I throw away an array_map because it ended up looking too bloated and go with a classic foreach instead. Short Closures 2.0 without the use(...) block would've solved this problem, just 2 votes...