Hi folks,
Currently, it's not possible to use the ::class special constant with the
constant() function. This doesn't work:
var_dump(
constant('\DateTime::class')
);
For instance, Twig's constant() helper internally uses this PHP function,
consequently the following Twig template doesn't work:
`myObject` contains a random object, retrieve its class:
{{ constant('class', myObject) }}
I wrote a patch adding support for ::class:
https://github.com/php/php-src/pull/6763
As this probably qualifies as a new feature, should I write an RFC too?
Cheers,