Skip to content

Commit eb438af

Browse files
committed
fix: No quotes for the enum case according to https://www.typescriptlang.org/docs/handbook/enums.html
1 parent e006219 commit eb438af

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Transformers/EnumTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function transform(ReflectionClass $class, string $name): ?TransformedTyp
4343
protected function toEnum(ReflectionEnum $enum, string $name): TransformedType
4444
{
4545
$options = array_map(
46-
fn (ReflectionEnumBackedCase $case) => "'{$case->getName()}' = {$this->toEnumValue($case)}",
46+
fn (ReflectionEnumBackedCase $case) => "{$case->getName()} = {$this->toEnumValue($case)}",
4747
$enum->getCases()
4848
);
4949

tests/Transformers/EnumTransformerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
'Enum'
6161
);
6262

63-
assertEquals("'JS' = 'js', 'PHP' = 'php', 'BackslashesTest' = 'backslashes\\\\test'", $type->transformed);
63+
assertEquals("JS = 'js', PHP = 'php', BackslashesTest = 'backslashes\\\\test'", $type->transformed);
6464
assertTrue($type->missingSymbols->isEmpty());
6565
assertFalse($type->isInline);
6666
assertEquals('enum', $type->keyword);
@@ -92,7 +92,7 @@
9292
'Enum'
9393
);
9494

95-
assertEquals("'JS' = 1, 'PHP' = 2", $type->transformed);
95+
assertEquals("JS = 1, PHP = 2", $type->transformed);
9696
assertTrue($type->missingSymbols->isEmpty());
9797
assertFalse($type->isInline);
9898
assertEquals('enum', $type->keyword);

0 commit comments

Comments
 (0)