@@ -195,6 +195,30 @@ public function testIgnoresObjectsInSignature()
195
195
TestServiceWithStaticProperty::$ initializedObject = new TestServiceWithStaticProperty ();
196
196
$ this ->assertTrue ($ res ->isFresh (0 ));
197
197
}
198
+
199
+ public function testEnum ()
200
+ {
201
+ $ res = new ReflectionClassResource ($ enum = new \ReflectionClass (SomeEnum::class));
202
+ $ r = new \ReflectionClass (ReflectionClassResource::class);
203
+ $ generateSignature = $ r ->getMethod ('generateSignature ' )->getClosure ($ res );
204
+ $ actual = implode ("\n" , iterator_to_array ($ generateSignature ($ enum )));
205
+ $ this ->assertStringContainsString ('UnitEnum ' , $ actual );
206
+ $ this ->assertStringContainsString ('TestAttribute ' , $ actual );
207
+ $ this ->assertStringContainsString ('Beta ' , $ actual );
208
+ }
209
+
210
+ public function testBackedEnum ()
211
+ {
212
+ $ res = new ReflectionClassResource ($ enum = new \ReflectionClass (SomeBackedEnum::class));
213
+ $ r = new \ReflectionClass (ReflectionClassResource::class);
214
+ $ generateSignature = $ r ->getMethod ('generateSignature ' )->getClosure ($ res );
215
+ $ actual = implode ("\n" , iterator_to_array ($ generateSignature ($ enum )));
216
+ $ this ->assertStringContainsString ('UnitEnum ' , $ actual );
217
+ $ this ->assertStringContainsString ('BackedEnum ' , $ actual );
218
+ $ this ->assertStringContainsString ('TestAttribute ' , $ actual );
219
+ $ this ->assertStringContainsString ('Beta ' , $ actual );
220
+ $ this ->assertStringContainsString ('beta ' , $ actual );
221
+ }
198
222
}
199
223
200
224
interface DummyInterface
@@ -225,3 +249,19 @@ class TestServiceWithStaticProperty
225
249
{
226
250
public static object $ initializedObject ;
227
251
}
252
+
253
+ enum SomeEnum
254
+ {
255
+ case Alpha;
256
+
257
+ #[TestAttribute]
258
+ case Beta;
259
+ }
260
+
261
+ enum SomeBackedEnum: string
262
+ {
263
+ case Alpha = 'alpha ' ;
264
+
265
+ #[TestAttribute]
266
+ case Beta = 'beta ' ;
267
+ }
0 commit comments