Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvanassche authored and actions-user committed Dec 16, 2021
1 parent de714d3 commit a68b0be
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/Structures/TransformedType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down
4 changes: 2 additions & 2 deletions src/Transformers/EnumTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())
);

Expand All @@ -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())
);

Expand Down
7 changes: 4 additions & 3 deletions src/Transformers/MyclabsEnumTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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()
);

Expand Down
7 changes: 4 additions & 3 deletions src/Transformers/SpatieEnumTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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())
);

Expand Down
1 change: 0 additions & 1 deletion tests/TypeProcessors/DtoCollectionTypeProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a68b0be

Please sign in to comment.