On 13/10/2021 10:17, Guilliam Xavier wrote:
Off-topic:
if ( class_exists('\\WeakMap') ) {
People should stop using a leading slash in FQCN *strings*.
\Foo::class is "Foo", not "\Foo". It might work generally but that's
asking for problems (e.g. for autoloaders).
(Sorry.)
Hah, good point. I should probably just have just used ::class anyway
(in which case the leading backslash is the quickest way of the sample
code being pasteable into some other file):
if ( class_exists(\WeakMap::class) ) {
There's probably a bunch of other style no-noes in that example, but I
did at least test it worked. :)
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php