Skip to content

Commit ddc5cca

Browse files
refactor: pint fixes
1 parent 2a0adb1 commit ddc5cca

35 files changed

+270
-231
lines changed

resources/config/livewire-powergrid.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?php
22

3+
use PowerComponents\LivewirePowerGrid\Components\Exports\OpenSpout\v5\{ExportToCsv, ExportToXLS};
4+
use PowerComponents\LivewirePowerGrid\FilterAttributes\{Boolean, InputText, Number, Select};
5+
use PowerComponents\LivewirePowerGrid\Themes\Tailwind;
6+
37
return [
48

59
/*
@@ -11,7 +15,7 @@
1115
| Configure here the theme of your choice.
1216
*/
1317

14-
'theme' => \PowerComponents\LivewirePowerGrid\Themes\Tailwind::class,
18+
'theme' => Tailwind::class,
1519
// 'theme' => \PowerComponents\LivewirePowerGrid\Themes\DaisyUI::class,
1620
// 'theme' => \PowerComponents\LivewirePowerGrid\Themes\Bootstrap5::class,
1721

@@ -109,10 +113,10 @@
109113
*/
110114

111115
'filter_attributes' => [
112-
'input_text' => \PowerComponents\LivewirePowerGrid\FilterAttributes\InputText::class,
113-
'boolean' => \PowerComponents\LivewirePowerGrid\FilterAttributes\Boolean::class,
114-
'number' => \PowerComponents\LivewirePowerGrid\FilterAttributes\Number::class,
115-
'select' => \PowerComponents\LivewirePowerGrid\FilterAttributes\Select::class,
116+
'input_text' => InputText::class,
117+
'boolean' => Boolean::class,
118+
'number' => Number::class,
119+
'select' => Select::class,
116120
],
117121

118122
/*
@@ -140,12 +144,12 @@
140144
'exportable' => [
141145
'default' => 'openspout_v4',
142146
'openspout_v5' => [
143-
'xlsx' => \PowerComponents\LivewirePowerGrid\Components\Exports\OpenSpout\v5\ExportToXLS::class,
144-
'csv' => \PowerComponents\LivewirePowerGrid\Components\Exports\OpenSpout\v5\ExportToCsv::class,
147+
'xlsx' => ExportToXLS::class,
148+
'csv' => ExportToCsv::class,
145149
],
146150
'openspout_v4' => [
147-
'xlsx' => \PowerComponents\LivewirePowerGrid\Components\Exports\OpenSpout\v4\ExportToXLS::class,
148-
'csv' => \PowerComponents\LivewirePowerGrid\Components\Exports\OpenSpout\v4\ExportToCsv::class,
151+
'xlsx' => PowerComponents\LivewirePowerGrid\Components\Exports\OpenSpout\v4\ExportToXLS::class,
152+
'csv' => PowerComponents\LivewirePowerGrid\Components\Exports\OpenSpout\v4\ExportToCsv::class,
149153
],
150154
],
151155

src/Commands/Actions/ListModels.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace PowerComponents\LivewirePowerGrid\Commands\Actions;
44

5+
use Illuminate\Database\Eloquent\Model;
56
use Illuminate\Support\Facades\File;
67
use ReflectionClass;
78
use ReflectionException;
@@ -37,7 +38,7 @@ public static function handle(): array
3738
/**
3839
* @throws ReflectionException
3940
*/
40-
->reject(fn (string $fqnClass) => rescue(fn () => (new ReflectionClass($fqnClass))->isSubclassOf(\Illuminate\Database\Eloquent\Model::class), false) === false)
41+
->reject(fn (string $fqnClass) => rescue(fn () => (new ReflectionClass($fqnClass))->isSubclassOf(Model::class), false) === false)
4142
->all();
4243
}
4344
}

src/Commands/InteractsWithVersions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class InteractsWithVersions
2323
*/
2424
public function ensureLatestVersion(): array
2525
{
26-
$composer = Factory::create(new NullIo());
26+
$composer = Factory::create(new NullIO());
2727
$localRepo = $composer->getRepositoryManager()->getLocalRepository();
2828

2929
return $this->searchPackage($localRepo);

src/DataSource/Processors/ModelProcessor.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace PowerComponents\LivewirePowerGrid\DataSource\Processors;
44

55
use Illuminate\Pipeline\Pipeline;
6+
use Illuminate\Support\Collection;
67
use PowerComponents\LivewirePowerGrid\DataSource\DataTransformer;
78
use PowerComponents\LivewirePowerGrid\DataSource\Processors\Database\Pipelines;
89
use PowerComponents\LivewirePowerGrid\DataSource\Processors\Pipelines as CommonPipelines;
@@ -38,7 +39,7 @@ public function process(array $properties = []): array
3839
])
3940
->thenReturn();
4041

41-
/** @var \Illuminate\Support\Collection $collection */
42+
/** @var Collection $collection */
4243
$collection = $paginate->getCollection();
4344

4445
if (filled(data_get($this->component, 'setUp.lazy'))) {

src/Livewire/LazyChild.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function shouldShowToggleable(array|Column|stdClass $column, mixed $row):
6969

7070
private function getComponentAlias(): ?string
7171
{
72-
if (class_exists(\Livewire\Mechanisms\ComponentRegistry::class)) {
72+
if (class_exists(ComponentRegistry::class)) {
7373

7474
return app(ComponentRegistry::class)->getClass($this->parentName);
7575
}

src/Traits/WithExport.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ protected function onBatchFinally(Batch $batch): void {}
157157
/**
158158
* @throws Exception
159159
*/
160-
public function prepareToExport(bool $selected = false): Eloquent\Collection|Support\Collection
160+
public function prepareToExport(bool $selected = false): Eloquent\Collection|Collection
161161
{
162162
$processDataSource = tap(ProcessDataSource::make($this), fn ($datasource) => $datasource->get());
163163

@@ -188,7 +188,7 @@ public function prepareToExport(bool $selected = false): Eloquent\Collection|Sup
188188
$property = function (string $property) use ($processDataSource, $currentTable) {
189189
$property = $processDataSource->component->{$property};
190190

191-
return Support\Str::of($property)->contains('.')
191+
return Str::of($property)->contains('.')
192192
? $property
193193
: $currentTable.'.'.$property;
194194
};

tests/Datasets/FilterComponent.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?php
22

3+
use PowerComponents\LivewirePowerGrid\Themes\{Bootstrap5, Tailwind};
4+
35
require __DIR__.'/../Concerns/Components/ComponentsForFilterTest.php';
46

57
dataset('filterComponent', [
6-
'tailwind -> id' => [$component::class, (object) ['theme' => \PowerComponents\LivewirePowerGrid\Themes\Tailwind::class, 'field' => 'name']],
7-
'bootstrap -> id' => [$component::class, (object) ['theme' => \PowerComponents\LivewirePowerGrid\Themes\Bootstrap5::class, 'field' => 'name']],
8-
'tailwind -> dishes.id' => [$componentJoin::class, (object) ['theme' => \PowerComponents\LivewirePowerGrid\Themes\Tailwind::class, 'field' => 'dishes.name']],
9-
'bootstrap -> dishes.id' => [$componentJoin::class, (object) ['theme' => \PowerComponents\LivewirePowerGrid\Themes\Bootstrap5::class, 'field' => 'dishes.name']],
8+
'tailwind -> id' => [$component::class, (object) ['theme' => Tailwind::class, 'field' => 'name']],
9+
'bootstrap -> id' => [$component::class, (object) ['theme' => Bootstrap5::class, 'field' => 'name']],
10+
'tailwind -> dishes.id' => [$componentJoin::class, (object) ['theme' => Tailwind::class, 'field' => 'dishes.name']],
11+
'bootstrap -> dishes.id' => [$componentJoin::class, (object) ['theme' => Bootstrap5::class, 'field' => 'dishes.name']],
1012
]);

tests/Feature/ActionsViewTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
use PowerComponents\LivewirePowerGrid\Column;
44
use PowerComponents\LivewirePowerGrid\Tests\Concerns\Components\DishesTable;
5+
use PowerComponents\LivewirePowerGrid\Themes\{Bootstrap5, DaisyUI, Tailwind};
56

67
use function PowerComponents\LivewirePowerGrid\Tests\Plugins\livewire;
78

@@ -45,7 +46,7 @@ public function actionsFromView($row)
4546
'Dish From Actions View: 6',
4647
]);
4748
})->with([
48-
'tailwind' => [$component::class, (object) ['theme' => \PowerComponents\LivewirePowerGrid\Themes\Tailwind::class, 'field' => 'name']],
49-
'bootstrap' => [$component::class, (object) ['theme' => \PowerComponents\LivewirePowerGrid\Themes\Bootstrap5::class, 'field' => 'name']],
50-
'daisyui' => [$component::class, (object) ['theme' => \PowerComponents\LivewirePowerGrid\Themes\DaisyUI::class, 'field' => 'name']],
49+
'tailwind' => [$component::class, (object) ['theme' => Tailwind::class, 'field' => 'name']],
50+
'bootstrap' => [$component::class, (object) ['theme' => Bootstrap5::class, 'field' => 'name']],
51+
'daisyui' => [$component::class, (object) ['theme' => DaisyUI::class, 'field' => 'name']],
5152
]);

tests/Feature/BeforeSearchTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
use PowerComponents\LivewirePowerGrid\Tests\Concerns\Components\DishesBeforeSearchTable;
4+
use PowerComponents\LivewirePowerGrid\Themes\{Bootstrap5, DaisyUI, Tailwind};
45

56
use function PowerComponents\LivewirePowerGrid\Tests\Plugins\livewire;
67

@@ -14,9 +15,9 @@
1415
->set('search', '')
1516
->assertSee('Peixada');
1617
})->with([
17-
'tailwind' => [DishesBeforeSearchTable::class, (object) ['theme' => \PowerComponents\LivewirePowerGrid\Themes\Tailwind::class]],
18-
'bootstrap' => [DishesBeforeSearchTable::class, (object) ['theme' => \PowerComponents\LivewirePowerGrid\Themes\Bootstrap5::class]],
19-
'daisyui' => [DishesBeforeSearchTable::class, (object) ['theme' => \PowerComponents\LivewirePowerGrid\Themes\DaisyUI::class]],
18+
'tailwind' => [DishesBeforeSearchTable::class, (object) ['theme' => Tailwind::class]],
19+
'bootstrap' => [DishesBeforeSearchTable::class, (object) ['theme' => Bootstrap5::class]],
20+
'daisyui' => [DishesBeforeSearchTable::class, (object) ['theme' => DaisyUI::class]],
2021
]);
2122

2223
it('can use beforeSearch in boolean field', function (string $component, object $params) {
@@ -38,7 +39,7 @@
3839
->assertSee('Barco-Sushi Simples')
3940
->assertDontSee('Pastel de Nata');
4041
})->with([
41-
'tailwind' => [DishesBeforeSearchTable::class, (object) ['theme' => \PowerComponents\LivewirePowerGrid\Themes\Tailwind::class]],
42-
'bootstrap' => [DishesBeforeSearchTable::class, (object) ['theme' => \PowerComponents\LivewirePowerGrid\Themes\Bootstrap5::class]],
43-
'daisyui' => [DishesBeforeSearchTable::class, (object) ['theme' => \PowerComponents\LivewirePowerGrid\Themes\DaisyUI::class]],
42+
'tailwind' => [DishesBeforeSearchTable::class, (object) ['theme' => Tailwind::class]],
43+
'bootstrap' => [DishesBeforeSearchTable::class, (object) ['theme' => Bootstrap5::class]],
44+
'daisyui' => [DishesBeforeSearchTable::class, (object) ['theme' => DaisyUI::class]],
4445
]);

tests/Feature/CalculationsCollectionTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
use PowerComponents\LivewirePowerGrid\Tests\Concerns\Components\DishesCalculationsCollectionTable;
4+
use PowerComponents\LivewirePowerGrid\Themes\{Bootstrap5, DaisyUI, Tailwind};
45

56
use function PowerComponents\LivewirePowerGrid\Tests\Plugins\livewire;
67

@@ -45,7 +46,7 @@
4546
})->with('calculations collection');
4647

4748
dataset('calculations collection', [
48-
'tailwind' => [DishesCalculationsCollectionTable::class, (object) ['theme' => \PowerComponents\LivewirePowerGrid\Themes\Tailwind::class]],
49-
'bootstrap' => [DishesCalculationsCollectionTable::class, (object) ['theme' => \PowerComponents\LivewirePowerGrid\Themes\Bootstrap5::class]],
50-
'daisyui' => [DishesCalculationsCollectionTable::class, (object) ['theme' => \PowerComponents\LivewirePowerGrid\Themes\DaisyUI::class]],
49+
'tailwind' => [DishesCalculationsCollectionTable::class, (object) ['theme' => Tailwind::class]],
50+
'bootstrap' => [DishesCalculationsCollectionTable::class, (object) ['theme' => Bootstrap5::class]],
51+
'daisyui' => [DishesCalculationsCollectionTable::class, (object) ['theme' => DaisyUI::class]],
5152
]);

0 commit comments

Comments
 (0)