@@ -58,6 +58,7 @@ abstract class AbstractEnum
58
58
* Constructor is private to ensure instances are created through static methods.
59
59
*
60
60
* @since n.e.x.t
61
+ *
61
62
* @param string $value The enum value.
62
63
* @param string $name The constant name.
63
64
*/
@@ -71,6 +72,7 @@ final private function __construct(string $value, string $name)
71
72
* Provides read-only access to properties.
72
73
*
73
74
* @since n.e.x.t
75
+ *
74
76
* @param string $property The property name.
75
77
* @return mixed The property value.
76
78
* @throws BadMethodCallException If property doesn't exist.
@@ -90,6 +92,7 @@ final public function __get(string $property)
90
92
* Prevents property modification.
91
93
*
92
94
* @since n.e.x.t
95
+ *
93
96
* @param string $property The property name.
94
97
* @param mixed $value The value to set.
95
98
* @throws BadMethodCallException Always, as enum properties are read-only.
@@ -105,6 +108,7 @@ final public function __set(string $property, $value): void
105
108
* Creates an enum instance from a value, throws exception if invalid.
106
109
*
107
110
* @since n.e.x.t
111
+ *
108
112
* @param string $value The enum value.
109
113
* @return static The enum instance.
110
114
* @throws InvalidArgumentException If the value is not valid.
@@ -124,6 +128,7 @@ final public static function from(string $value): self
124
128
* Tries to create an enum instance from a value, returns null if invalid.
125
129
*
126
130
* @since n.e.x.t
131
+ *
127
132
* @param string $value The enum value.
128
133
* @return static|null The enum instance or null.
129
134
*/
@@ -142,6 +147,7 @@ final public static function tryFrom(string $value): ?self
142
147
* Gets all enum cases.
143
148
*
144
149
* @since n.e.x.t
150
+ *
145
151
* @return static[] Array of all enum instances.
146
152
*/
147
153
final public static function cases (): array
@@ -158,6 +164,7 @@ final public static function cases(): array
158
164
* Checks if this enum has the same value as the given value.
159
165
*
160
166
* @since n.e.x.t
167
+ *
161
168
* @param string|self $other The value or enum to compare.
162
169
* @return bool True if values are equal.
163
170
*/
@@ -174,6 +181,7 @@ final public function equals($other): bool
174
181
* Checks if this enum is the same instance type and value as another enum.
175
182
*
176
183
* @since n.e.x.t
184
+ *
177
185
* @param self $other The other enum to compare.
178
186
* @return bool True if enums are identical.
179
187
*/
@@ -186,6 +194,7 @@ final public function is(self $other): bool
186
194
* Gets all valid values for this enum.
187
195
*
188
196
* @since n.e.x.t
197
+ *
189
198
* @return array<string, string> Map of constant names to values.
190
199
*/
191
200
final public static function getValues (): array
@@ -197,6 +206,7 @@ final public static function getValues(): array
197
206
* Checks if a value is valid for this enum.
198
207
*
199
208
* @since n.e.x.t
209
+ *
200
210
* @param string $value The value to check.
201
211
* @return bool True if value is valid.
202
212
*/
@@ -209,6 +219,7 @@ final public static function isValidValue(string $value): bool
209
219
* Gets or creates a singleton instance for the given value and name.
210
220
*
211
221
* @since n.e.x.t
222
+ *
212
223
* @param string $value The enum value.
213
224
* @param string $name The constant name.
214
225
* @return static The enum instance.
@@ -234,6 +245,7 @@ private static function getInstance(string $value, string $name): self
234
245
* Gets all constants for this enum class.
235
246
*
236
247
* @since n.e.x.t
248
+ *
237
249
* @return array<string, string> Map of constant names to values.
238
250
* @throws \RuntimeException If invalid constant found.
239
251
*/
@@ -285,6 +297,7 @@ final protected static function getConstants(): array
285
297
* Handles dynamic method calls for enum checking.
286
298
*
287
299
* @since n.e.x.t
300
+ *
288
301
* @param string $name The method name.
289
302
* @param array<mixed> $arguments The method arguments.
290
303
* @return bool True if the enum value matches.
@@ -311,6 +324,7 @@ final public function __call(string $name, array $arguments): bool
311
324
* Handles static method calls for enum creation.
312
325
*
313
326
* @since n.e.x.t
327
+ *
314
328
* @param string $name The method name.
315
329
* @param array<mixed> $arguments The method arguments.
316
330
* @return static The enum instance.
@@ -334,6 +348,7 @@ final public static function __callStatic(string $name, array $arguments): self
334
348
* Converts camelCase to CONSTANT_CASE.
335
349
*
336
350
* @since n.e.x.t
351
+ *
337
352
* @param string $camelCase The camelCase string.
338
353
* @return string The CONSTANT_CASE version.
339
354
*/
@@ -350,6 +365,7 @@ private static function camelCaseToConstant(string $camelCase): string
350
365
* Returns string representation of the enum.
351
366
*
352
367
* @since n.e.x.t
368
+ *
353
369
* @return string The enum value.
354
370
*/
355
371
final public function __toString (): string
0 commit comments