medabkari's avatar

Patrick

medabkari

Member since

70

Total Reputation

2

Total Arguments

8

Total Votes for Arguments

Arguments and votes

2

It just makes sense and also optional, so whoever doesn't like it can go back to using parentheses.

Share:
Read the RFC: new MyClass()->method() without parentheses medabkari avatar
medabkari
voted yes
12

Every time I find myself typing new MyClass() and than returning back and adding those parentheses. It would be good to reduce this friction and make PHP coding flow smoother.

Share:
Read the RFC: new MyClass()->method() without parentheses pronskiy avatar
pronskiy
voted yes
17

Often, I add static methods to some classes in order to improve readability when I instantiate a new class; the ability of chaining methods directly to the constructor, without the unnecessary parenthesis boilerplate, would remove the need for that.

Share:
Read the RFC: new MyClass()->method() without parentheses reddalo avatar
reddalo
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:
Read the RFC: Short Closures 2.0 medabkari avatar
medabkari
voted yes
87

With First-class callable syntax available since 8.1, it would now be possible to write it as below, which is much better then string names of functions:

$result = "Hello World"
    |> htmlentities(...)
    |> str_split(...)
    |> fn($x) => array_map(strtoupper(...), $x)
    |> fn($x) => array_filter($x, fn($v) => $v != 'O');
Share:
Read the RFC: The Pipe Operator pronskiy avatar
pronskiy
voted yes
13

I really do not want to see this in PHP because it tempts to apply closures on everything. The question is not if we can but if we should.

Share:
Read the RFC: Short Closures 2.0 marko avatar
marko
voted no
39

PHP is evolving. There are new concepts added to many programming languages to ease writing and reading (more important!). PHP should focus more on developer experience (but not for legacy projects that get never upgraded to PHP 8+).

Share:
Read the RFC: Short Closures 2.0 eugen avatar
eugen
voted yes
121

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...

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