Re: Is there an RFC/discussion for ::class being a specific type?
| From: | Kamil Tekiela | Date: | Tue, 16 Nov 2021 18:56:56 +0000 |
| Subject: | Re: Is there an RFC/discussion for ::class being a specific type? | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-116423@lists.php.net to get a copy of this message | ||
Ok, but a popular usage is also with functions. For example, strlen::class.
What should the compiler use in this case?
Replacing a string with an object of a strigable class is not the same. Say
I have code like this:
function callFoo(callable $func) {
echo $func('bar');
}
callFoo(strlen::class);
This would trigger an error as the ClassName is not an invokable class.