Re: [PHP-DEV] Add support for ::class to constant()

2021-03-15 Thread Nikita Popov
On Tue, Mar 9, 2021 at 11:16 PM Kévin Dunglas wrote: > 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

Re: [PHP-DEV] Add support for ::class to constant()

2021-03-13 Thread Rowan Tommins
On 9 March 2021 22:15:49 GMT, "Kévin Dunglas" wrote: >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') >); While this looks logical at first glance, I'm not sure this can

Re: [PHP-DEV] Add support for ::class to constant()

2021-03-09 Thread Kamil Tekiela
Hi Kévin, My opinion is that you should write an RFC. I have to admit I was a little confused when I initially read your email, because I never considered ::class to be a constant. It is a special constant, which is described as a keyword in the manual. If I understand it correctly the value is

[PHP-DEV] Add support for ::class to constant()

2021-03-09 Thread Kévin Dunglas
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