You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Obtain an instance will change from |`$enumCase = Action::VIEW()`|`$enumCase = Action::VIEW`|
170
+
| Create an enum from a backed value |`$enumCase = new Action('view')`|`$enumCase = Action::from('view')`|
171
+
| Get the backed value of the enum instance |`$enumCase->getValue()`|`$enumCase->value`|
172
+
| Compare two enum instances |`$enumCase1 == $enumCase2` <br/> or <br/> `$enumCase1->equals($enumCase2)`|`$enumCase1 === $enumCase2`|
173
+
| Get the key/name of the enum instance |`$enumCase->getKey()`|`$enumCase->name`|
174
+
| Get a list of all the possible instances of the enum |`Action::values()`|`Action::cases()`|
175
+
| Get a map of possible instances of the enum mapped by name |`Action::values()`|`array_combine(array_map(fn($case) => $case->name, Action::cases()), Action::cases())` <br/> or <br/> `(new ReflectionEnum(Action::class))->getConstants()`|
176
+
| Get a list of all possible names of the enum |`Action::keys()`|`array_map(fn($case) => $case->name, Action::cases())`|
177
+
| Get a list of all possible backed values of the enum |`Action::toArray()`|`array_map(fn($case) => $case->value, Action::cases())`|
178
+
| Get a map of possible backed values of the enum mapped by name |`Action::toArray()`|`array_combine(array_map(fn($case) => $case->name, Action::cases()), array_map(fn($case) => $case->value, Action::cases()))` <br/> or <br/> `array_map(fn($case) => $case->value, (new ReflectionEnum(Action::class))->getConstants()))`|
0 commit comments