Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvanassche authored and github-actions[bot] committed May 3, 2024
1 parent ecea4cc commit 067305d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/DataPipes/CastPropertiesDataPipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected function cast(
) {
try {
$context = $creationContext->next($property->type->dataClass, $property->name);

$data = $property->type->kind->isDataObject()
? $context->from($value)
: $context->collect($value, $property->type->iterableClass);
Expand Down
12 changes: 6 additions & 6 deletions tests/CreationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,29 @@
use Illuminate\Support\Facades\Route;
use Illuminate\Validation\ValidationException;

use Spatie\LaravelData\DataPipeline;
use Spatie\LaravelData\DataPipes\DataPipe;
use Spatie\LaravelData\Support\Creation\CreationContext;
use Spatie\LaravelData\Support\DataClass;
use function Pest\Laravel\postJson;

use Spatie\LaravelData\Attributes\Computed;

use Spatie\LaravelData\Attributes\DataCollectionOf;
use Spatie\LaravelData\Attributes\Validation\Min;
use Spatie\LaravelData\Attributes\WithCast;

use Spatie\LaravelData\Attributes\WithCastable;

use Spatie\LaravelData\Casts\DateTimeInterfaceCast;
use Spatie\LaravelData\Casts\Uncastable;
use Spatie\LaravelData\Concerns\WithDeprecatedCollectionMethod;
use Spatie\LaravelData\Contracts\DeprecatedData as DeprecatedDataContract;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\DataCollection;
use Spatie\LaravelData\DataPipeline;
use Spatie\LaravelData\DataPipes\DataPipe;
use Spatie\LaravelData\Exceptions\CannotCreateData;
use Spatie\LaravelData\Exceptions\CannotSetComputedValue;
use Spatie\LaravelData\Lazy;
use Spatie\LaravelData\Optional;
use Spatie\LaravelData\Support\Creation\CreationContext;
use Spatie\LaravelData\Support\DataClass;
use Spatie\LaravelData\Tests\Fakes\Castables\SimpleCastable;
use Spatie\LaravelData\Tests\Fakes\Casts\ConfidentialDataCast;
use Spatie\LaravelData\Tests\Fakes\Casts\ConfidentialDataCollectionCast;
Expand Down Expand Up @@ -1153,4 +1154,3 @@ public static function pipeline(): DataPipeline
[10, SimpleData::from('Hello World')]
);
})->todo();

6 changes: 3 additions & 3 deletions tests/PartialsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,18 +236,18 @@
'nested' => [DummyDto::rick()],
], [
'nested' => [DummyDto::bon()],
]
],
], DataCollection::class);

expect($data->toArray())->toMatchArray([
['nested' => [[]]],
['nested' => [[]]]
['nested' => [[]]],
]);

expect($data->include('nested.{artist,year}')->toArray())
->toMatchArray([
['nested' => [['artist' => DummyDto::rick()->artist, 'year' => DummyDto::rick()->year]]],
['nested' => [['artist' => DummyDto::bon()->artist, 'year' => DummyDto::bon()->year]]]
['nested' => [['artist' => DummyDto::bon()->artist, 'year' => DummyDto::bon()->year]]],
]);
});

Expand Down

0 comments on commit 067305d

Please sign in to comment.