RE: [PHP-DEV] Raising the precedence of the new operator

From: Date: Mon, 05 Apr 2021 19:51:35 +0000
Subject: RE: [PHP-DEV] Raising the precedence of the new operator
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-113964@lists.php.net to get a copy of this message
 Mike Schinkel wrote:

> I had asked Ben what he thought about allowing the following syntax as a synonym for new
> Foo():
>
> Foo::new()

This can already be done in application code, having the language add a synonym is IMO unnecessary
magic and breaks the
principle of the least surprise.

The solution proposed in https://bugs.php.net/bug.php?id=70549 however is
very similar to what I'm asking.
Note that in that bug entry the solution was based on the premise that $obj = new
$foo->bar(); was valid code, which
it isn't. (https://3v4l.org/lpN1T)


Thread (14 messages)

« previous php.internals (#113964) next »