Re: Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically
| From: | Ollie Read | Date: | Mon, 23 Jan 2023 16:16:30 +0000 |
| Subject: | Re: Introduce the abiltiy to use the first-call-callable syntax on non-static methods, statically | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119398@lists.php.net to get a copy of this message | ||
Oh, I didn't mean to suggest that it automatically binds.
My second suggestion for how to achieve this does require some sort of automation. If you create a
closure from Str::someMethod($arg1, $arg2) where someMethod isn't static, it should create a
closure with the signature fn(Str $object, $arg1, $arg2), which would wrap a call to [$object,
'someMethod]($arg1, $arg2).
However, perhaps the simplest solution, and one that could be done realtively easily and quickly,
would be to delay the error, and allow static closures to bound with Closure::bind() if they
represent a non-static method.
---
Best Regards,
*Ollie Read*