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()();
It is very annoying to wrap new class into parentheses.
Yeah finally. its necessary
This syntax, will make the code more readable, clean.
This is very clean
I love it, it's cleaner
It is really confusing to read since having the space breaks the way PHP handles spaces in all other places. It is incoherent.
I honestly don't really care about that small sugar, but I lean more towards yes than no, so ship it
Parentheses do not add anything to a human to understand what is going on.
Since PHP does not require curly braces in strings most of the time, we can get rid of those parentheses too (when they are not required by the language anymore).
The absence of parentheses leads to a decrease in clarity of intent
The code will be easier to read
If we remove parentheses for this case, why having them for the if statement and so on?
I think it's necessary for the parentheses to be kept because you have to prioritize the object instanciation to use a method it exposes.
It could led to typos because of the space between New and the Class instantiated, the "old" approach is more readable too
first of all it looks wrong
its a method on an object, which itself could be chainable; wrapping it in brackets makes it it object
not logical to remove them.
A new syntax for declaring the “set” operation visibility of an object property
Interface Default Methods improves backwards compatibility when changing interfaces, but also add a way to have multi-inheritance in PHP.