Short Closures 2.0

Read the RFC
101
373 yes
66 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

I would really love this!

Share:
william-2 avatar
william-2
voted yes
1

It keeps code so much cleaner, easier to read, and is already intuitive because of how most modern frontend apps are written.

Share:
kegan avatar
kegan
voted yes
1

It's not an uncommon syntax. Other languages do this. Could be handy. If you're against it, just write it the long way and/or have your code sniffer reject it. You don't have to use it.

Share:
jklmnop avatar
jklmnop
voted yes
1

Always disliked the use of use.

Share:
yassine avatar
yassine
voted yes
1

It helps me to write clear readable code

Share:
bob avatar
bob
voted yes
1

why not? other languages have this.

Share:
rastusik avatar
rastusik
voted yes
1

Please could you provide an example?

Share:
ranvir avatar
ranvir
voted no
1

Improves code clarity via succinctness

Share:
andy avatar
andy
voted yes
1

I can't see any need for multi line arrow functions, if that is what we are talking about, because anonymous functions provide that already.

Share:
william avatar
william
voted no
1

Why not, less code = better

Share:
ilya avatar
ilya
voted yes
1

It’s elegant and the next step towards the evolution of the language.

Share:
eduardo avatar
eduardo
voted yes

Check out another RFCs

The Pipe Operator

The "pipe operator" |> allows you to chain multiple function calls in a more convenient way.

90
262 yes
122 no
Property Hooks

A new way of interacting with properties

64
122 yes
78 no
Interface Default Methods

Interface Default Methods improves backwards compatibility when changing interfaces, but also add a way to have multi-inheritance in PHP.

95
168 yes
263 no
RSS Feed Contribute Watch on YouTube Our License
© 2024 RFC Vote. This project is open source. Contribute and collaborate with us!