diff --git a/src/Structures/TransformedType.php b/src/Structures/TransformedType.php index ec40729..40a830f 100644 --- a/src/Structures/TransformedType.php +++ b/src/Structures/TransformedType.php @@ -93,7 +93,8 @@ public function replaceSymbol(string $class, string $replacement): void ); } - public function toString(): string { + public function toString(): string + { return match ($this->keyword) { 'enum' => "enum {$this->name} { {$this->transformed} }", default => "type {$this->name} = {$this->transformed}", diff --git a/src/Transformers/EnumTransformer.php b/src/Transformers/EnumTransformer.php index ca441f3..497c87b 100644 --- a/src/Transformers/EnumTransformer.php +++ b/src/Transformers/EnumTransformer.php @@ -34,7 +34,7 @@ protected function toEnum(ReflectionClass $class, string $name): TransformedType $enum = (new ReflectionEnum($class->getName())); $options = array_map( - fn($enum) => "'{$enum}' = '{$enum}'", + fn ($enum) => "'{$enum}' = '{$enum}'", array_keys($enum->getConstants()) ); @@ -51,7 +51,7 @@ protected function toType(ReflectionClass $class, string $name): TransformedType $enum = (new ReflectionEnum($class->getName())); $options = array_map( - fn($enum) => "'{$enum}'", + fn ($enum) => "'{$enum}'", array_keys($enum->getConstants()) ); diff --git a/src/Transformers/MyclabsEnumTransformer.php b/src/Transformers/MyclabsEnumTransformer.php index 4a4f089..cab53b6 100644 --- a/src/Transformers/MyclabsEnumTransformer.php +++ b/src/Transformers/MyclabsEnumTransformer.php @@ -30,8 +30,9 @@ protected function toEnum(ReflectionClass $class, string $name): TransformedType $enum = $class->getName(); $options = array_map( - fn($key, $value) => "'{$key}' = '{$value}'", - array_keys($enum::toArray()), $enum::toArray() + fn ($key, $value) => "'{$key}' = '{$value}'", + array_keys($enum::toArray()), + $enum::toArray() ); return TransformedType::create( @@ -48,7 +49,7 @@ protected function toType(ReflectionClass $class, string $name): TransformedType $enum = $class->getName(); $options = array_map( - fn(Enum $enum) => "'{$enum->getValue()}'", + fn (Enum $enum) => "'{$enum->getValue()}'", $enum::values() ); diff --git a/src/Transformers/SpatieEnumTransformer.php b/src/Transformers/SpatieEnumTransformer.php index 2948a83..5824c67 100644 --- a/src/Transformers/SpatieEnumTransformer.php +++ b/src/Transformers/SpatieEnumTransformer.php @@ -30,8 +30,9 @@ protected function toEnum(ReflectionClass $class, string $name): TransformedType $enum = $class->getName(); $options = array_map( - fn($key, $value) => "'{$key}' = '{$value}'", - array_keys($enum::toArray()), $enum::toArray() + fn ($key, $value) => "'{$key}' = '{$value}'", + array_keys($enum::toArray()), + $enum::toArray() ); return TransformedType::create( @@ -48,7 +49,7 @@ private function toType(ReflectionClass $class, string $name): TransformedType $enum = $class->getName(); $options = array_map( - fn($enum) => "'{$enum}'", + fn ($enum) => "'{$enum}'", array_keys($enum::toArray()) ); diff --git a/tests/TypeProcessors/DtoCollectionTypeProcessorTest.php b/tests/TypeProcessors/DtoCollectionTypeProcessorTest.php index 6744fc3..06384c6 100644 --- a/tests/TypeProcessors/DtoCollectionTypeProcessorTest.php +++ b/tests/TypeProcessors/DtoCollectionTypeProcessorTest.php @@ -4,7 +4,6 @@ use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Array_; -use phpDocumentor\Reflection\Types\Mixed_; use PHPUnit\Framework\TestCase; use Spatie\TypeScriptTransformer\Structures\MissingSymbolsCollection; use Spatie\TypeScriptTransformer\Tests\FakeClasses\Collections\DtoCollection;