Re: Re: [RFC] Callable constructors
| From: | Rowan Collins | Date: | Sat, 27 Feb 2016 18:59:42 +0000 |
| Subject: | Re: Re: [RFC] Callable constructors | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-91443@lists.php.net to get a copy of this message | ||
On 26/02/2016 11:47, Nikita Nefedov wrote:
There are lots of types of callable which can't be serialized already - anonymous functions, invokable objects, instance methods - so I'm still not convinced why this particular one is so important. Anything that can only take its callback as a string already rejects many things that are otherwise callable, so I'm not sure why having to reject a wrapped constructor is so much worse that it needs a new language concept. Regards, -- Rowan Collins [IMSoP]Hey Andrea, This would still not solve Dan's problem though. Which is representingThen 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.new Classas a serializeable callable.