diff --git a/tests/Actions/TranspileTypeToTypeScriptActionTest.php b/tests/Actions/TranspileTypeToTypeScriptActionTest.php index 87fcb28..0752927 100644 --- a/tests/Actions/TranspileTypeToTypeScriptActionTest.php +++ b/tests/Actions/TranspileTypeToTypeScriptActionTest.php @@ -4,15 +4,15 @@ use phpDocumentor\Reflection\Types\Self_; use phpDocumentor\Reflection\Types\Static_; use phpDocumentor\Reflection\Types\This; +use function PHPUnit\Framework\assertContains; +use function PHPUnit\Framework\assertEquals; +use function Spatie\Snapshots\assertMatchesSnapshot; use Spatie\TypeScriptTransformer\Actions\TranspileTypeToTypeScriptAction; + use Spatie\TypeScriptTransformer\Structures\MissingSymbolsCollection; use Spatie\TypeScriptTransformer\Tests\FakeClasses\Enum\RegularEnum; use Spatie\TypeScriptTransformer\Types\StructType; -use function PHPUnit\Framework\assertContains; -use function PHPUnit\Framework\assertEquals; -use function Spatie\Snapshots\assertMatchesSnapshot; - beforeEach(function () { $this->missingSymbols = new MissingSymbolsCollection(); diff --git a/tests/Transformers/DtoTransformerTest.php b/tests/Transformers/DtoTransformerTest.php index 0c4b533..5ba756b 100644 --- a/tests/Transformers/DtoTransformerTest.php +++ b/tests/Transformers/DtoTransformerTest.php @@ -2,6 +2,9 @@ use phpDocumentor\Reflection\Type; use phpDocumentor\Reflection\Types\String_; +use function PHPUnit\Framework\assertEquals; +use function Spatie\Snapshots\assertMatchesSnapshot; +use function Spatie\Snapshots\assertMatchesTextSnapshot; use Spatie\TypeScriptTransformer\Attributes\Hidden; use Spatie\TypeScriptTransformer\Attributes\LiteralTypeScriptType; use Spatie\TypeScriptTransformer\Attributes\Optional; @@ -13,14 +16,11 @@ use Spatie\TypeScriptTransformer\Tests\FakeClasses\Integration\Enum; use Spatie\TypeScriptTransformer\Tests\FakeClasses\Integration\LevelUp\YetAnotherDto; use Spatie\TypeScriptTransformer\Tests\FakeClasses\Integration\OtherDto; + use Spatie\TypeScriptTransformer\Transformers\DtoTransformer; use Spatie\TypeScriptTransformer\TypeProcessors\TypeProcessor; use Spatie\TypeScriptTransformer\TypeScriptTransformerConfig; -use function PHPUnit\Framework\assertEquals; -use function Spatie\Snapshots\assertMatchesSnapshot; -use function Spatie\Snapshots\assertMatchesTextSnapshot; - beforeEach(function () { $config = TypeScriptTransformerConfig::create() ->defaultTypeReplacements([ @@ -49,10 +49,10 @@ it('a type processor can remove properties', function () { $config = TypeScriptTransformerConfig::create(); - $transformer = new class ($config) extends DtoTransformer { + $transformer = new class($config) extends DtoTransformer { protected function typeProcessors(): array { - $onlyStringPropertiesProcessor = new class () implements TypeProcessor { + $onlyStringPropertiesProcessor = new class() implements TypeProcessor { public function process( Type $type, ReflectionProperty | ReflectionParameter | ReflectionMethod $reflection, @@ -75,7 +75,7 @@ public function process( }); it('will take transform as typescript attributes into account', function () { - $class = new class () { + $class = new class() { #[TypeScriptType('int')] public $int; @@ -103,7 +103,7 @@ public function process( }); it('transforms properties to optional ones when using optional attribute', function () { - $class = new class () { + $class = new class() { #[Optional] public string $string; }; @@ -134,7 +134,7 @@ class DummyOptionalDto it('transforms properties to hidden ones when using hidden attribute', function () { - $class = new class () { + $class = new class() { public string $visible; #[Hidden] public string $hidden; @@ -149,7 +149,7 @@ class DummyOptionalDto }); it('transforms nullable properties to optional ones according to config', function () { - $class = new class () { + $class = new class() { public ?string $string; }; diff --git a/tests/Transformers/InterfaceTransformerTest.php b/tests/Transformers/InterfaceTransformerTest.php index df7f2b7..f043b6a 100644 --- a/tests/Transformers/InterfaceTransformerTest.php +++ b/tests/Transformers/InterfaceTransformerTest.php @@ -1,13 +1,13 @@