Skip to content

Commit 437c282

Browse files
Merge pull request #97 from ABartelt/main
fix: No quotes for the enum case according to typescriptlang.org
2 parents 8f981ed + eb438af commit 437c282

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
@@ -61,7 +61,7 @@
6161
'Enum'
6262
);
6363

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

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

0 commit comments

Comments
 (0)