Skip to content

class-string not enforced in constants #2798

@jbafford

Description

@jbafford

Bug report

If a class constant is annotated as taking a class-string<>, the annotation is ignored for constants (but used for variables).

Code snippet that reproduces the problem

https://phpstan.org/r/edd455a3-e8fc-424d-af68-d1a0a2e9d219

Expected output

Both the constant and the variable should emit an error, not just the variable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions