On 08/06/2010, at 12.41, Johannes Schlüter wrote:

> On Tue, 2010-06-08 at 12:23 +0200, Jacob Oettinger wrote:
>> Would it be equally simple to allow the syntax below?
>> 
>> $result = new ResultMaker()->getIt();
> 
> does this mean 
> 
>    $result = new (ResultMaker()->getIt());
> 
> or
> 
>    $result = (new ResultMaker())->getIt();
> 
> I assume the later, but that is non-obvious as we allow
> 
>    $result = new $class();

Yes the later. I do not see how the above makes it non-obvious. 

As I see it the new operator will always instantiate the class name that comes 
after it. The name can be given as either a literal class name, or as a string 
variable or as a string variable in an array. It can not be given as a function 
or method that returns a string.

Regardless, it was the direct calling of a function (or invokable) returned 
from a function I think was a good idea for consistency.

Jacob


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to