This RFC allows to omit parentheses around the new expression when constructor arguments' parentheses are present.
$highlighter = (new Highlighter())->withGutter(); $highlighter = new Highlighter()->withGutter();
It also works with accessing properties, constants, etc.
new MyClass()::CONSTANT; new MyClass()::$staticProperty; new MyClass()::staticMethod(); new MyClass()->property; new MyClass()->method(); new MyClass()();
lgtm
I think this feels a lot cleaner. Not sure what the internal implications of this are but I like it.
Much cleaner
Makes it just cleaner
Ship it!
me parece una buena adición al lenguaje
It is a good quality of live improvement, I can't think of a possible downside
I think I would be fine if this had been in PHP all along, but for all existing developers this proposal really messes up my feeling for reading code. PHP always considers a space between words/symbols as a separator between two things. If you want to combine the result of that, you need to always use parentheses, so why create an exception here?
Less code is better code, this is implicit language priority no need to express it
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.
The "pipe operator" |>
allows you to chain multiple function calls in a more convenient way.