@@ -326,4 +326,31 @@ public function testMixedWithNullable(): void
326326 $ this ->assertSame ('mixed|object ' , $ type ->getDocBlockTypeHint ());
327327 $ this ->assertSame ('mixed|object ' , $ type ->getTypeHint (true ));
328328 }
329+
330+ public function testEnumStringValues (): void
331+ {
332+ $ type = Type::enumString ('value1 ' , 'value2 ' , 'value3 ' );
333+ $ this ->assertSame ("'value1'|'value2'|'value3' " , $ type ->getDocBlockTypeHint ());
334+ $ this ->assertNull ($ type ->getTypeHint ());
335+ $ this ->assertNull ($ type ->getTypeHint (true ));
336+ }
337+
338+ public function testEnumStringValueNullable (): void
339+ {
340+ $ type = Type::enumString ('value1 ' , 'value2 ' , 'value3 ' );
341+ $ type ->addUnion ('null ' );
342+ $ this ->assertSame ("'value1'|'value2'|'value3'|null " , $ type ->getDocBlockTypeHint ());
343+ $ this ->assertNull ($ type ->getTypeHint ());
344+ $ this ->assertNull ($ type ->getTypeHint (true ));
345+ }
346+
347+ public function testEnumStringValueNullableAndClass (): void
348+ {
349+ $ type = Type::enumString ('value1 ' , 'value2 ' , 'value3 ' );
350+ $ type ->addUnion ('null ' );
351+ $ type ->addUnion (\BackedEnum::class);
352+ $ this ->assertSame ("'value1'|'value2'|'value3'|BackedEnum|null " , $ type ->getDocBlockTypeHint ());
353+ $ this ->assertNull ($ type ->getTypeHint ());
354+ $ this ->assertNull ($ type ->getTypeHint (true ));
355+ }
329356}
0 commit comments