Skip to content

Commit 2b67293

Browse files
hailwoodgithub-actions[bot]
authored andcommitted
Fix styling
1 parent 5ad4dfd commit 2b67293

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

src/DataProvider.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Webfox\InertiaDataProviders;
56

7+
use Illuminate\Contracts\Support\Arrayable;
8+
use Inertia\LazyProp;
69
use ReflectionClass;
710
use ReflectionMethod;
8-
use Inertia\LazyProp;
911
use ReflectionProperty;
10-
use Illuminate\Contracts\Support\Arrayable;
1112

1213
abstract class DataProvider implements Arrayable
1314
{
@@ -20,26 +21,26 @@ public static function collection(DataProvider|array ...$dataProviders): DataPro
2021

2122
public function toArray(): array
2223
{
23-
$staticData = $this->staticData instanceof Arrayable ? $this->staticData->toArray() : $this->staticData;
24+
$staticData = $this->staticData instanceof Arrayable ? $this->staticData->toArray() : $this->staticData;
2425
$reflectionClass = (new ReflectionClass($this));
2526

2627
$convertedProperties = collect($reflectionClass->getProperties(ReflectionProperty::IS_PUBLIC))
27-
->filter(fn(ReflectionProperty $property) => !$property->isStatic())
28-
->mapWithKeys(fn(ReflectionProperty $property) => [$property->getName() => $property->getValue($this)])
29-
->map(fn($value) => $value instanceof Arrayable ? $value->toArray() : $value);
28+
->filter(fn (ReflectionProperty $property) => ! $property->isStatic())
29+
->mapWithKeys(fn (ReflectionProperty $property) => [$property->getName() => $property->getValue($this)])
30+
->map(fn ($value) => $value instanceof Arrayable ? $value->toArray() : $value);
3031

3132
$convertedMethods = collect($reflectionClass->getMethods(ReflectionMethod::IS_PUBLIC))
32-
->filter(fn(ReflectionMethod $method) => !$method->isStatic())
33-
->filter(fn(ReflectionMethod $method) => !$method->isStatic() && !in_array($method->name, ['toArray', '__construct']))
33+
->filter(fn (ReflectionMethod $method) => ! $method->isStatic())
34+
->filter(fn (ReflectionMethod $method) => ! $method->isStatic() && ! in_array($method->name, ['toArray', '__construct']))
3435
->mapWithKeys(function (ReflectionMethod $method) {
3536
// @phpstan-ignore-next-line
3637
if ($method->getReturnType()?->getName() === LazyProp::class) {
3738
return [$method->name => $method->invoke($this)];
3839
}
3940

40-
return [$method->name => fn() => app()->call([$this, $method->name])];
41+
return [$method->name => fn () => app()->call([$this, $method->name])];
4142
});
4243

4344
return collect()->merge($staticData)->merge($convertedProperties)->merge($convertedMethods)->toArray();
4445
}
45-
}
46+
}

src/DataProviderCollection.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Webfox\InertiaDataProviders;
56

7+
use Illuminate\Contracts\Support\Arrayable;
68
use Illuminate\Support\Arr;
79
use Illuminate\Support\Collection;
8-
use Illuminate\Contracts\Support\Arrayable;
910

1011
class DataProviderCollection implements Arrayable
1112
{
@@ -20,8 +21,9 @@ public function __construct(DataProvider|array ...$dataProviders)
2021

2122
public function add(DataProvider|array ...$dataProviders): static
2223
{
23-
$this->dataProviders = $this->dataProviders->concat(collect($dataProviders)
24-
->map(fn(DataProvider|array $dataProvider) => Arr::wrap($dataProvider))
24+
$this->dataProviders = $this->dataProviders->concat(
25+
collect($dataProviders)
26+
->map(fn (DataProvider|array $dataProvider) => Arr::wrap($dataProvider))
2527
->flatten()
2628
->filter()
2729
);
@@ -34,7 +36,7 @@ public function add(DataProvider|array ...$dataProviders): static
3436
*/
3537
public function remove(string $dataProvider): static
3638
{
37-
$this->dataProviders = $this->dataProviders->filter(fn(DataProvider $instance) => $instance::class !== $dataProvider);
39+
$this->dataProviders = $this->dataProviders->filter(fn (DataProvider $instance) => $instance::class !== $dataProvider);
3840

3941
return $this;
4042
}
@@ -47,6 +49,7 @@ public function collection(): Collection
4749
public function empty(): static
4850
{
4951
$this->dataProviders = collect();
52+
5053
return $this;
5154
}
5255

@@ -71,7 +74,7 @@ public function when(bool|callable $condition, callable $callback): static
7174
*/
7275
public function unless(bool|callable $condition, callable $callback): static
7376
{
74-
if (!value($condition)) {
77+
if (! value($condition)) {
7578
$callback($this);
7679
}
7780

@@ -81,7 +84,7 @@ public function unless(bool|callable $condition, callable $callback): static
8184
public function toArray(): array
8285
{
8386
return $this->dataProviders
84-
->flatMap(fn(DataProvider $dataProvider) => $dataProvider->toArray())
87+
->flatMap(fn (DataProvider $dataProvider) => $dataProvider->toArray())
8588
->all();
8689
}
87-
}
90+
}

0 commit comments

Comments
 (0)