All notable changes to enum-helper
will be documented in this file.
- add
wrap()
method toEnumFrom
trait - change
EnumUniqueId
toEnumSerialization
trait and change separator to::
- add
EnumLabel
trait if you prefer use ->label() istead of ->desceription() - add new
EnumProperties
trait - general refactoring
- update pest and phpstan versions
- add pint formatting
- update github workflow
- Add
nullableDescriptionsByValue
method
- v 1.0 🚀 🎉
- Added Inspection methods (
isPure()
,isBacked()
,has()
,doesntHave()
,hasName()
,doesntHaveName()
,hasValue()
,doesntHaveValue()
) - Refactored readme examples and test classes name
- permit enum equality to compare IntBackedEnum with numeric string
- added support of null param on
in()
andnotIn()
methods
After migrating several projects with my fellow @RobertoNegro and listening to different opinions we have decided to simplify the package.
From now on, I will consider a pure enum as a StringBackedEnum
with names as values, so all ***AsSelect()
methods will be replaced by ***ByValue()
methods.
- removed all methods
***AsSelect()
- added support on
***ByValue()
methods also for pure enum using name instead value - removed
NotBackedEnum
exception
- added
fromValue()
andtryFromValue()
aliases - refactored EnumFromTest.php
- set public dynamic methods
- moved the Laravel part of package to new
laravel-enum-helper
package - updated the banner
- moved
LaravelEnum
toDatomatic\EnumHelper\Traits\Laravel
namespace - code refactor
Renamed these methods:
namesArray()
=>namesByValue()
valuesArray()
=>valuesByName()
descriptionsArray()
splitted into 2 methods descriptionsByName()
, descriptionsByValue()
Renamed EnumLaravelLocalization
trait to LaravelEnum
Added new [method]AsSelect()
methods that return [method]ByValue()
if is BackedEnum
, [method]ByName()
otherwise.
Added these exceptions:
NotBackedEnum
EmptyCases
UndefinedStaticMethod
Added dynamic methods on LaravelEnum trait
- Fixed README.md
- Added return type on InvalidUniqueId exception
- Merge translations and descriptions
- Move UniqueId out of EnumHelper
First release 🚀