marc-mabe / php-enum

Simple and fast implementation of enumerations with native PHP
BSD 3-Clause "New" or "Revised" License
464 stars 36 forks source link

`Enum#getValue()` should `@psalm-return static::*` #144

Closed Ocramius closed 3 years ago

Ocramius commented 4 years ago

Reporting it mostly for self-reference (want to open a PR when I have time to test it), but the return type of Enum#getValue() should be @psalm-return static::*, indicating that it is the value of any of the defined constants.

marc-mabe commented 4 years ago

I think this would include private, protected and public constants where only public constants are possible.

For PHPStan we have created an extension for this: https://github.com/marc-mabe/php-enum-phpstan