File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 1313 ],
1414 "require" : {
1515 "php" : " ^7.4|^8.0" ,
16+ "ext-json" : " *" ,
1617 "ext-mbstring" : " *"
1718 },
1819 "require-dev" : {
Original file line number Diff line number Diff line change 44
55namespace DeSmart \Enum ;
66
7+ use JsonSerializable ;
78use function DeSmart \Enum \Helpers \toConstName ;
89
9- abstract class Enumeration
10+ abstract class Enumeration implements JsonSerializable
1011{
1112 /**
1213 * @var int|string
@@ -77,6 +78,14 @@ public function __toString(): string
7778 return (string ) $ this ->getValue ();
7879 }
7980
81+ /**
82+ * @return int|string
83+ */
84+ public function jsonSerialize ()
85+ {
86+ return $ this ->value ;
87+ }
88+
8089 public function equals (Enumeration $ other ): bool
8190 {
8291 if (! $ other instanceof static) {
You can’t perform that action at this time.
0 commit comments