Skip to content

Missing support for enum constants #9005

@lcobucci

Description

@lcobucci

Bug report

PHPStan is identifying private constants declared and used in enums as unused.

PHP's manual does mention that Enums support constants:

The following object functionality is available, and behaves just as it does on any other object:

  • (...)
  • Public, private, and protected constants.
  • (...)

And that works just fine: https://3v4l.org/DfldI#v8.2.3

Code snippet that reproduces the problem

https://phpstan.org/r/b7b4a18b-b9c6-4eb1-8ea3-6ad9d2f2e01a

Expected output

No error should be reported.

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