File tree Expand file tree Collapse file tree 5 files changed +7
-57
lines changed Expand file tree Collapse file tree 5 files changed +7
-57
lines changed Original file line number Diff line number Diff line change 88 |
99 | Below you may register custom resource states that you want to use inside
1010 | your stateful resources. Each state must be a valid enum class that
11- | implements the ResourceState interface and uses the AsResourceState
12- | trait.
11+ | implements the ResourceState interface.
1312 |
1413 */
1514 'custom_states ' => [
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 22
33namespace Farbcode \StatefulResources \Contracts ;
44
5- interface ResourceState
6- {
7- /**
8- * Get the string value of the state.
9- */
10- public function value (): string ;
11-
12- /**
13- * Get the name of the state.
14- */
15- public function name (): string ;
16-
17- /**
18- * Create a state instance from a string value.
19- */
20- public static function from (string $ value ): static ;
21-
22- /**
23- * Try to create a state instance from a string value.
24- */
25- public static function tryFrom (string $ value ): ?static ;
26-
27- /**
28- * Get all available states.
29- */
30- public static function cases (): array ;
31- }
5+ /**
6+ * Interface for resource state enums that must be backed by string values.
7+ *
8+ * @template T of string
9+ */
10+ interface ResourceState extends \BackedEnum {}
Original file line number Diff line number Diff line change 22
33namespace Farbcode \StatefulResources \Enums ;
44
5- use Farbcode \StatefulResources \Concerns \AsResourceState ;
65use Farbcode \StatefulResources \Contracts \ResourceState ;
76
87enum Variant: string implements ResourceState
98{
10- use AsResourceState;
11-
129 case Minimal = 'minimal ' ;
1310 case Table = 'table ' ;
1411 case Full = 'full ' ;
Original file line number Diff line number Diff line change 22
33namespace Workbench \App \Enums ;
44
5- use Farbcode \StatefulResources \Concerns \AsResourceState ;
65use Farbcode \StatefulResources \Contracts \ResourceState ;
76
87enum CustomResourceStates: string implements ResourceState
98{
10- use AsResourceState;
11-
129 case Custom = 'custom ' ;
1310}
You can’t perform that action at this time.
0 commit comments