Fix ::class on string expression
I think this code pattern isn't supported: https://3v4l.org/MM1pJ
Absolutely right, but strangely enough this is: https://3v4l.org/Rb3oU
Whaat!? :) Sounds like an inconsistency that should be reported in https://github.com/php/php-src/issues :)
I just did: https://github.com/php/doc-en/issues/1646
I'll let this sit here until php/doc-en#1646 is resolved :)
So the conclusion in https://github.com/php/doc-en/issues/1646 is unequivocal :) Can you please add a test that 'Foo'::class is not reported by ClassConstantRule and this example is reported?
$foo = 'Foo';
var_dump($foo::class);
And maybe also assertType() for this example too to make sure we have an ErrorType there.
Thanks :)
The error cases are already covered by tests, so this should be ready to go :)
Absolutely right, but strangely enough this is: 3v4l.org/Rb3oU
may I ask how you realized this is a thing? did you see such code somewhere?
I stumbled upon it while fumbling around with phpstan/phpstan#7391 :sweat_smile:
Thank you!