php-enum
php-enum copied to clipboard
The enum PHP is missing, inspired from SplEnum
- Lock to v4.9 otherwise it bumps automatically, finds new issues and builds start failing without any change in this lib - Fix some psalm issues - Enable `findUnusedPsalmSuppress` -...
`Hi,` there is an example in the readme.md of Enum class with private constant. Why it uses private const instead of public const? Public modifier makes it possible to use...
Consider: ```php final class State extends Enum { public const Activated = 'Activated'; ... } ... $obj->state[State::Activated] = true; ``` Is this a mis-use of this mechanism? Should that be...
This is more of a FYI... I am running psalm on my own project with the `--find-unused-psalm-suppress` flag and even though I told psalm to ignore the vendor dir it...
This patch introduces two new methods: * `Enum::isValidEnumValue()` * `Enum::assertValidEnumValue()` The `Enum::isValidEnumValue()` is still wonky due to https://github.com/vimeo/psalm/issues/5372, but overall, this allows for matching against other `Enum` sub-types, by validating...
Ideally, `SomeEnum::Foo()` should always return the same instance of `SomeEnum`, so you can do `$someEnumValue1 === SomeEnum::Foo()` instead of `$someEnumValue1->getValue() !== SomeEnum::Foo`
Thanks for this library MyClabs :) Not sure if this should be resolved or not. I find it problematic that when searching, the method does not consider that there may...
The last passing build of master was running [psalm v3.8.5](https://travis-ci.org/github/myclabs/php-enum/jobs/650333835#L293), but after that, builds have been failing [psalm v3.11.5+](https://travis-ci.org/github/myclabs/php-enum/jobs/698596645#L295). I think the best options are either: 1. Put a composer.lock...
Here's another idea: Perhaps a variant of this class which doesn't have a value for each enum member, so `SomeEnum::FOO` doesn't work but `SomeEnum::FOO()` does? Could be used like so...
In PHPStorm, when you have code like ``$enum->equals()`` you don't have autocomplete of possible options. That _should_ be achievable with meta file: https://blog.jetbrains.com/phpstorm/2019/02/new-phpstorm-meta-php-features/ Now... I am not going to lie,...