Skip to content

Inconsistency about ::class and literal strings #1646

@ondrejmirtes

Description

@ondrejmirtes

Description

This doesn't work (https://3v4l.org/MM1pJ):

<?php

$foo = 'Foo';
var_dump($foo::class);

But this does (https://3v4l.org/Rb3oU)

<?php

var_dump('Foo'::class);

Is this intentional? I'd say both or neither should be supported.

PHP Version

Irrelevant

Operating System

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions