Re: [Discussion] Expand deprecation notice scope for partially supported callables
| From: | Guilliam Xavier | Date: | Mon, 30 May 2022 14:56:44 +0000 |
| Subject: | Re: [Discussion] Expand deprecation notice scope for partially supported callables | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117836@lists.php.net to get a copy of this message | ||
Hi Dan, just an error in this part:
> Or if support for less than PHP 8.1 can be dropped, using the first
> class callable syntax
> https://wiki.php.net/rfc/first_class_callable_syntax :
>
> if (is_callable(static::methodName(...))) {
> static::methodName();
> }
>
> or
>
> $fn = static::methodName(...);
> if (is_callable($fn)) {
> $fn();
> }
This throws an Error on
static::methodName(...) [if not callable],
before even passing it to is_callable(): https://3v4l.org/m29BK
And yes, code should probably better use a same variable for both the
check and the call, but that could also degrade DX (IDE
autocompletion, static analysis) especially if calling with
arguments...
(the other parts of your message have been answered by Juliette)
Regards,
--
Guilliam Xavier