Allow new Cl()->method()

php.internals

Michael Voříšek - ČVUT FEL

5 years ago
Hi devs, currently new Cl() must be wrapped in parentheses if that object is further used to call it's method like (new Cl())->method(). It there any reason why not to allow new Cl()->method() ? Based on https://www.php.net/manual/en/language.operators.precedence.php - the "new" operator has already the highest precedence, thus there should be no conflict. With kind regards / Mit freundlichen Grüßen / S přátelským pozdravem, Michael Voříšek ČVUT FEL