Allow new Cl()->method()
| From: | Michael Voříšek - ČVUT FEL | Date: | Wed, 02 Dec 2020 20:02:46 +0000 |
| Subject: | Allow new Cl()->method() | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-112382@lists.php.net to get a copy of this message | ||
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