Re: Method chaining off constructors
| From: | Robert Cummings | Date: | Fri, 06 Jun 2008 15:42:38 +0000 |
| Subject: | Re: Method chaining off constructors | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-275100@lists.php.net to get a copy of this message | ||
On Fri, 2008-06-06 at 11:35 -0400, Christoph Boget wrote:
> > The 'new' keyword has to apply to the object created in the constructor (and
> > not the return value of any of the follow-up calls.) To establish this
> > precedence, chaining wasn't allowed on constructors.
>
> If precedence was the issue, why doesn't this work, either:
>
> (new bob())->one()->two()
>
> ? Or, rather, why couldn't that have been taken into consideration?
It seems a bit futile asking on PHP General when this a question for the
PHP Internals list. That is where these kinds of decisions are made.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP