robier/enum

PHP enums implementation

v1.0.0 2023-11-08 09:12 UTC

This package is auto-updated.

Last update: 2024-09-08 10:58:06 UTC


README

This is yet another enum implementation in PHP.

When we did not have enums in PHP this library was trying to fix that. Now we have enums with PHP version 8.1 so there is no need for "yet another enum implementation". This library was changed to add "missing" features to already existing enums.

Supported features:

When using "Boolean checks", you can easily create a doc blocks for magic functions so your IDE can be developer friendly.

$ vendor/bin/enum [FQN enum]

It will just generate all magic methods in stdout. It will not change actual files.

Development

This project is dockerized. Before running tests you need to build a docker container by using provided script from the docker folder.

 $ docker/build

After the build is finished, you can run any command by using:

 $ docker/run %command%

for example:

 $ docker/run composer install

Additional tools for developing:

  • composer test - runs all PHPUnit tests
  • XDEBUG_MODE=coverage composer test:coverage:html - runs all PHPUnit tests and generates HTML report
  • composer test:infestation - runs mutation tests and generates mutation score

Feel free to contribute.