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 Jan 7, 2022
1 parent 485e5db commit ce0b785
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
25 changes: 12 additions & 13 deletions tests/DataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
use Iterator;
use Spatie\LaravelData\Attributes\WithTransformer;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\DataCollection;
Expand Down Expand Up @@ -70,7 +69,7 @@ public function it_can_include_a_lazy_property()
DataPropertyBlueprintFactory::new('name')->lazy()->withType('string')
)->create();

$data = new $dataClass(Lazy::create(fn() => 'test'));
$data = new $dataClass(Lazy::create(fn () => 'test'));

$this->assertEquals([], $data->toArray());

Expand Down Expand Up @@ -106,8 +105,8 @@ public function it_can_include_a_nested_lazy_property()
)->create();

$data = new $dataClass(
Lazy::create(fn() => LazyData::from('Hello')),
Lazy::create(fn() => LazyData::collection(['is', 'it', 'me', 'your', 'looking', 'for',])),
Lazy::create(fn () => LazyData::from('Hello')),
Lazy::create(fn () => LazyData::collection(['is', 'it', 'me', 'your', 'looking', 'for',])),
);

$this->assertEquals([], (clone $data)->toArray());
Expand Down Expand Up @@ -150,7 +149,7 @@ public function it_can_include_specific_nested_data()
DataPropertyBlueprintFactory::dataCollection('songs', MultiLazyData::class)->lazy()
)->create();

$collection = Lazy::create(fn() => MultiLazyData::collection([
$collection = Lazy::create(fn () => MultiLazyData::collection([
DummyDto::rick(),
DummyDto::bon(),
]));
Expand Down Expand Up @@ -205,7 +204,7 @@ public function __construct(
public static function create(string $name): static
{
return new self(
Lazy::when(fn() => $name === 'Ruben', fn() => $name)
Lazy::when(fn () => $name === 'Ruben', fn () => $name)
);
}
};
Expand All @@ -231,7 +230,7 @@ public function __construct(
public static function create(string $name): static
{
return new self(
Lazy::when(fn() => $name === 'Ruben', fn() => $name)
Lazy::when(fn () => $name === 'Ruben', fn () => $name)
);
}
};
Expand All @@ -247,7 +246,7 @@ public function it_can_include_data_based_upon_relations_loaded()
/** @var \Illuminate\Database\Eloquent\Model $model */
$model = DummyModelWithCasts::make();

$data = new class (Lazy::whenLoaded('relation', $model, fn() => 'loaded')) extends Data {
$data = new class (Lazy::whenLoaded('relation', $model, fn () => 'loaded')) extends Data {
public function __construct(
public string|Lazy $relation,
) {
Expand Down Expand Up @@ -445,7 +444,7 @@ public function it_can_disable_excluding_data_dynamically_from_the_request()
/** @test */
public function it_can_get_the_data_object_without_transforming()
{
$data = new class ($dataObject = new SimpleData('Test'), $dataCollection = SimpleData::collection([new SimpleData('A'), new SimpleData('B'),]), Lazy::create(fn() => new SimpleData('Lazy')), 'Test', $transformable = new DateTime('16 may 1994'),) extends Data {
$data = new class ($dataObject = new SimpleData('Test'), $dataCollection = SimpleData::collection([new SimpleData('A'), new SimpleData('B'), ]), Lazy::create(fn () => new SimpleData('Lazy')), 'Test', $transformable = new DateTime('16 may 1994'), ) extends Data {
public function __construct(
public SimpleData $data,
public DataCollection $dataCollection,
Expand Down Expand Up @@ -503,7 +502,7 @@ public function __construct(public string $name)

$transformed = $data->additional([
'company' => 'Spatie',
'alt_name' => fn(Data $data) => "{$data->name} from Spatie",
'alt_name' => fn (Data $data) => "{$data->name} from Spatie",
])->toArray();

$this->assertEquals([
Expand Down Expand Up @@ -699,7 +698,7 @@ public function it_always_validates_requests_when_passed_to_the_from_method()
/** @test */
public function it_has_support_for_readonly_properties()
{
$dataClass = new class('test') extends Data {
$dataClass = new class ('test') extends Data {
public function __construct(
public readonly string $string,
) {
Expand All @@ -717,9 +716,9 @@ public function it_has_support_for_intersection_types()
{
$collection = collect(['a', 'b', 'c']);

$dataClass = new class($collection) extends Data {
$dataClass = new class ($collection) extends Data {
public function __construct(
public Arrayable&\Countable $intersection,
public Arrayable & \Countable $intersection,
) {
}
};
Expand Down
2 changes: 1 addition & 1 deletion tests/Support/DataPropertyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ public function it_can_get_the_data_class_for_a_data_object()
public function it_has_support_for_intersection_types()
{
$helper = $this->resolveHelper(new class () {
public Arrayable&Countable $property;
public Arrayable & Countable $property;
});

$this->assertEquals(new DataPropertyTypes([Arrayable::class, Countable::class]), $helper->types());
Expand Down

0 comments on commit ce0b785

Please sign in to comment.