1
0
Fork 0
mirror of https://github.com/archtechx/enums.git synced 2025-12-12 16:14:03 +00:00
Commit graph

13 commits

Author SHA1 Message Date
61ba79388b fix tests for PascalCase 2024-01-28 18:52:34 +01:00
fea911eba7 Support UPPER_SNAKE_CASE and PascalCase in stringOptions() (resolve #22) 2024-01-28 18:50:31 +01:00
6684067b9e Add stringOptions() method to the Options trait (resolve #12) 2024-01-12 23:11:09 +01:00
365b3447f5 Support defining #[Meta] on traits (resolve #9) 2024-01-12 22:35:58 +01:00
Thai Nguyen Hung
f0ea4c36c8
Comparable enum (#20)
* 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>
2024-01-12 22:02:32 +01:00
Samuel Levy
373a86a16e
Added "Invokable Cases" PHPStan extension (#13)
* Added "Invokable Cases" PHPStan extension

This includes a PHPStan extension to add support for `InvokableCases`
so that static analysis tools can understand the callable methods and
their return types.

The extension has been added in a way that will allow multiple extensions
in the future if required, with a single include file that will import
all extensions, or the option to include only specific extensions.

* Added "Invokable Cases" PHPStan extension testing
2022-08-25 00:27:44 +02:00
Samuel Štancl
55478c4eb7
Metadata (#8)
* Metadata

* Fix code style (php-cs-fixer)

* Code style

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
2022-03-29 20:11:06 +02:00
Samuel Levy
cc5bba1912
Issue #4: Added From trait (#7)
* #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>
2022-03-23 22:18:58 +01:00
Samuel Levy
0c87357a6e
Extend functionality to work with pure enums (#6)
* Extend functionality to work with pure enums

* Code review changes

Altered `::values()` to act like `::names()` for backed enums, code style fixes, general cleanups
2022-03-23 21:42:35 +01:00
Samuel Štancl
b50d001374 add names() and values() methods, resolve #1 2022-02-20 21:53:21 +01:00
Samuel Štancl
e01edd128f add options() method, resolve #2 2022-02-20 21:50:53 +01:00
Samuel Štancl
41b423da38 initial 2022-02-20 20:58:57 +01:00
f9fe9e5cab Initial commit 2022-02-20 19:51:56 +01:00