Re: Re: [RFC] Callable constructors
| From: | Andrea Faulds | Date: | Fri, 26 Feb 2016 11:28:19 +0000 |
| Subject: | Re: Re: [RFC] Callable constructors | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-91433@lists.php.net to get a copy of this message | ||
Hi Rowan,
Rowan Collins wrote:
On 25/02/2016 17:40, Andrea Faulds wrote: Snipped for brevity, but I agree with your sentiment here. Making __construct more magic seems like an imperfect solution to this. I'm not sure making a new magic method (new, __new, etc) is much better though, since it would serve such a limited purpose.Yeah, I do wonder if ::new would really be worth it.
Then we could add to that a special case for constructors: - Callable::forConstructor(string $class_name)Oh, that's quite a clean solution, I like that. Heck, no need for Callable, we already have ->getClosure() in Reflection. A modified version of that for constructors could work (ReflectionClass::getConstructorClosure() ?). Thanks. -- Andrea Faulds https://ajf.me/