1
0
Fork 0
mirror of https://github.com/archtechx/enums.git synced 2025-12-12 20:24:04 +00:00

General code cleanup (#28)

* 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>
This commit is contained in:
Márk Magyar 2025-06-07 01:11:53 +02:00 committed by GitHub
parent 6a0399823f
commit df3681965c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 52 additions and 38 deletions

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
test('pure enums can have metadata on cases', function () {
expect(Role::ADMIN->color())->toBe('indigo');
expect(Role::GUEST->color())->toBe('gray');