Short Closures 2.0

Read the RFC
98
368 yes
65 no

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.

Click the bar to cast your vote!
85%
15%
1

Best of both worlds (auto-capture + ability to build return value using intermediate variables).

Share:
invisiblesmiley avatar
invisiblesmiley
voted yes
1

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.

Share:
liam avatar
liam
voted yes
1

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.

Share:
ludwig-gramberg avatar
ludwig-gramberg
voted yes
1

Having used short closures for a while now they feel really good.

Share:
michael avatar
michael
voted yes
1

I think the proposition is not "must have" option but it's ok

Share:
yoshi129 avatar
yoshi129
voted yes
1

the biggest advantage for me is that you then need to use the use keyword when you need data from outside.

Share:
victor-falcon avatar
victor-falcon
voted yes
1

Just use "fn" everywhere my fingers hurt from typing "uction" all the time.

Share:
sidux avatar
sidux
voted yes
1

Multi lines short closures with arrow function? What we're missing!

Share:
mirchaemanuel avatar
mirchaemanuel
voted yes
1

It makes my code much clearly

Share:
indigoram89 avatar
indigoram89
voted yes
1

since we are moving in the c# direction, why not take a really good thing they do

Share:
ddruganov avatar
ddruganov
voted yes
1

That's a very good idea. More convenient than using use

Share:
bbldn05 avatar
bbldn05
voted yes
1

I don't see a reason for not implementing this. It would make writing closures much more easy and natural.

Share:
sebastiandittrich avatar
sebastiandittrich
voted yes
1

it will increase code readability to sky)

Share:
Loafer19 avatar
Loafer19
voted yes
1

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?

Share:
medabkari avatar
medabkari
voted yes
1

use(...) can be shortened easily.

Share:
ucansutlac avatar
ucansutlac
voted yes
RSS Feed Contribute Watch on YouTube Our License
© 2024 RFC Vote. This project is open source. Contribute and collaborate with us!