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 Jul 26, 2021
1 parent 639be15 commit 45b9730
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/Actions/ResolveDataObjectFromArrayAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ public function execute(string $class, array $values): Data
{
/** @var \Spatie\LaravelData\Data $data */
$data = collect($this->dataConfig->getDataProperties($class))
->mapWithKeys(fn(DataProperty $property) => [
->mapWithKeys(fn (DataProperty $property) => [
$property->name() => $this->resolveValue($property, $values[$property->name()] ?? null),
])
->pipe(fn(Collection $properties) => new $class(...$properties));
->pipe(fn (Collection $properties) => new $class(...$properties));

return $data;
}
Expand Down Expand Up @@ -51,7 +51,7 @@ private function resolveValue(DataProperty $property, mixed $value): mixed

if ($property->isDataCollection()) {
$items = array_map(
fn(array $item) => $this->execute($property->getDataClass(), $item),
fn (array $item) => $this->execute($property->getDataClass(), $item),
$value
);

Expand Down
5 changes: 0 additions & 5 deletions src/LaravelDataServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@

namespace Spatie\LaravelData;

use Spatie\LaravelData\Casts\CarbonCast;
use Spatie\LaravelData\Casts\CarbonImmutableCast;
use Spatie\LaravelData\Casts\DateTimeCast;
use Spatie\LaravelData\Casts\DateTimeImmutableCast;
use Spatie\LaravelData\Support\DataConfig;
use Spatie\LaravelData\Support\DataResolver;
use Spatie\LaravelData\Transformers\DateTransformer;
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;

Expand Down
7 changes: 3 additions & 4 deletions tests/DataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function __construct(
/** @test */
public function it_can_include_a_nested_lazy_property()
{
$data = new class(Lazy::create(fn () => LazyData::create('Hello')), Lazy::create(fn () => LazyData::collection([ 'is', 'it', 'me', 'your', 'looking', 'for', ])),) extends Data {
$data = new class(Lazy::create(fn () => LazyData::create('Hello')), Lazy::create(fn () => LazyData::collection([ 'is', 'it', 'me', 'your', 'looking', 'for', ])), ) extends Data {
public function __construct(
public Lazy | LazyData $data,
/** @var \Spatie\LaravelData\Tests\Fakes\LazyData[] */
Expand Down Expand Up @@ -324,8 +324,7 @@ public function it_can_manually_specify_a_transformer()
public function __construct(
#[WithTransformer(DateTransformer::class, 'd-m-Y')]
public $date
)
{
) {
}
};

Expand All @@ -349,7 +348,7 @@ public function it_can_dynamically_include_data_based_upon_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
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function it_can_covert_a_data_object_to_typescript()
{
$config = TypeScriptTransformerConfig::create();

$data = new class(null, 42, true, 'Hello world', 3.14, ['the', 'meaning', 'of', 'life'], Lazy::create(fn () => 'Lazy'), SimpleData::create('Simple data'), SimpleData::collection([]),) extends Data {
$data = new class(null, 42, true, 'Hello world', 3.14, ['the', 'meaning', 'of', 'life'], Lazy::create(fn () => 'Lazy'), SimpleData::create('Simple data'), SimpleData::collection([]), ) extends Data {
public function __construct(
public null | int $nullable,
public int $int,
Expand Down

0 comments on commit 45b9730

Please sign in to comment.