* Add .idea folder to .gitignore
* Remove useless concatenation
* Add phpunit cache directory to .gitignore
* Use iterable type instead of unnecessary checks
* Remove unnecessary null coalescing
If the return value is `null`, it will return `null` anyway. If the method doesn't exist, it will throw an `Error` because of the undefined method.
* Add typehint
* Merge meta properties in one go instead of in a loop
* Simplify control flow
* Use non-deprecated phpstan configuration value
* Add missing types
* Fix style with php-cs-fixer
* Add tests that satisfy the ArrayIterator branch
* Use is() for comparison in in()
* from(int|string), tryFrom(int|string)
---------
Co-authored-by: Samuel Štancl <samuel@archte.ch>
* feat: comparable enum
* test: comparable enum
* ci: php-cs-fixer in repository scope
* chore: add `Comparable` usage in README
* ci: globally use `php-cs-fixer`
* improve Comparable logic
* test more PHP versions in CI
* update ci job name
* remove class name quoting in exceptions to match PHP behavior
* migrate pest config
* add comment to test
---------
Co-authored-by: Samuel Štancl <samuel@archte.ch>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
* #4 Added `From` trait
This adds the `from()` and `tryFrom()` methods to pure enums, and the `fromName()` and `tryFromName()` methods for all enum types.
* Code review changes
Dropped support for fragile indexes on pure enums
* Dropped unnecessary array_pop()
* import ValueError
* remove import
Co-authored-by: Samuel Štancl <samuel@archte.ch>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>