diff --git a/src/Core/Handlers/Handler.php b/src/Core/Handlers/Handler.php index 716b10055..a38e5bf75 100644 --- a/src/Core/Handlers/Handler.php +++ b/src/Core/Handlers/Handler.php @@ -12,7 +12,6 @@ use MoonShine\Support\Traits\WithLabel; use MoonShine\Support\Traits\WithQueue; use MoonShine\Support\Traits\WithUriKey; -use MoonShine\UI\Components\ActionButton; use MoonShine\UI\Contracts\Actions\ActionButtonContract; use Symfony\Component\HttpFoundation\Response; @@ -57,7 +56,7 @@ public function modifyButton(Closure $closure): static protected function prepareButton(ActionButtonContract $button): ActionButtonContract { - if(!is_null($this->modifyButton)) { + if(! is_null($this->modifyButton)) { return value($this->modifyButton, $button, $this); } diff --git a/src/Core/Request.php b/src/Core/Request.php index 893421699..acbb0e1d8 100644 --- a/src/Core/Request.php +++ b/src/Core/Request.php @@ -56,7 +56,7 @@ public function has(string $key): bool public function getAll(): Collection { - $body = $this->request->getParsedBody(); + $body = $this->request->getParsedBody(); $files = $this->request->getUploadedFiles(); $query = $this->request->getQueryParams(); diff --git a/src/Laravel/Fields/Relationships/BelongsToMany.php b/src/Laravel/Fields/Relationships/BelongsToMany.php index 9b4a66995..433a66527 100644 --- a/src/Laravel/Fields/Relationships/BelongsToMany.php +++ b/src/Laravel/Fields/Relationships/BelongsToMany.php @@ -31,7 +31,6 @@ use MoonShine\UI\Contracts\MoonShineRenderable; use MoonShine\UI\Fields\Checkbox; use MoonShine\UI\Fields\Field; -use MoonShine\UI\Fields\File; use MoonShine\UI\Fields\FormElement; use MoonShine\UI\Fields\ID; use MoonShine\UI\Fields\Preview; diff --git a/src/Laravel/Pages/Crud/IndexPage.php b/src/Laravel/Pages/Crud/IndexPage.php index fb8215055..6a8daab32 100644 --- a/src/Laravel/Pages/Crud/IndexPage.php +++ b/src/Laravel/Pages/Crud/IndexPage.php @@ -5,7 +5,6 @@ namespace MoonShine\Laravel\Pages\Crud; use MoonShine\Core\Exceptions\ResourceException; -use MoonShine\Laravel\Buttons\FiltersButton; use MoonShine\Laravel\Buttons\QueryTagButton; use MoonShine\Laravel\Collections\Fields; use MoonShine\Laravel\Components\Fragment; diff --git a/src/UI/Collections/Fields.php b/src/UI/Collections/Fields.php index 390a7c129..643a500d6 100644 --- a/src/UI/Collections/Fields.php +++ b/src/UI/Collections/Fields.php @@ -5,7 +5,6 @@ namespace MoonShine\UI\Collections; use Illuminate\Support\Collection; -use Illuminate\Support\Stringable; use MoonShine\Core\Contracts\CastedData; use MoonShine\UI\Contracts\Collections\FieldsCollection; use MoonShine\UI\Contracts\Fields\FieldsWrapper; diff --git a/src/UI/Traits/Fields/FileTrait.php b/src/UI/Traits/Fields/FileTrait.php index 24088f058..8d22c4f9d 100644 --- a/src/UI/Traits/Fields/FileTrait.php +++ b/src/UI/Traits/Fields/FileTrait.php @@ -179,7 +179,7 @@ public function remainingValuesResolver(Closure $closure): static public function getRemainingValues(): Collection { - if(!is_null($this->remainingValuesResolver)) { + if(! is_null($this->remainingValuesResolver)) { return value($this->remainingValuesResolver, $this); } diff --git a/src/UI/Traits/Fields/WithQuickFormElementAttributes.php b/src/UI/Traits/Fields/WithQuickFormElementAttributes.php index 23db1ed54..41de313fb 100644 --- a/src/UI/Traits/Fields/WithQuickFormElementAttributes.php +++ b/src/UI/Traits/Fields/WithQuickFormElementAttributes.php @@ -77,7 +77,7 @@ protected function prepareNameAttribute($index = null, $wrap = null): string ! is_null($wrap), fn (Stringable $str): Stringable => $str->prepend("$wrap.") ) - ->pipe(fn(Stringable $str) => $this->getDotNestedToName($str->value())) + ->pipe(fn (Stringable $str) => $this->getDotNestedToName($str->value())) ->when( $this->isGroup() || $this->getAttribute('multiple'), fn (Stringable $str): Stringable => $str->append( @@ -89,14 +89,14 @@ protected function prepareNameAttribute($index = null, $wrap = null): string public function generateNameFrom(?string ...$values): string { return str('') - ->pipe(static function(Stringable $str) use($values) { + ->pipe(static function (Stringable $str) use ($values) { foreach (collect($values)->filter() as $value) { $str = $str->append(".$value"); } return $str->trim('.'); }) - ->pipe(fn(Stringable $str) => $this->getDotNestedToName($str->value())) + ->pipe(fn (Stringable $str) => $this->getDotNestedToName($str->value())) ->value(); } diff --git a/tests/Feature/Fields/JsonFieldTest.php b/tests/Feature/Fields/JsonFieldTest.php index 052c17b78..89d74bd5f 100644 --- a/tests/Feature/Fields/JsonFieldTest.php +++ b/tests/Feature/Fields/JsonFieldTest.php @@ -57,7 +57,7 @@ function testJsonValue(TestResource $resource, Item $item, array $data, ?array $ 'data' => [ ['title' => 'Title 1', 'value' => 'Value 1', 'file' => $file], ['title' => 'Title 2', 'value' => 'Value 2', 'file' => $file], - ] + ], ]; asAdmin()->put( @@ -97,7 +97,7 @@ function testJsonValue(TestResource $resource, Item $item, array $data, ?array $ 'data' => [ ['title' => 'Title 1', 'value' => 'Value 1'], ['title' => 'Title 2', 'value' => 'Value 2', 'hidden_file' => $file->hashName()], - ] + ], ]; asAdmin()->put( diff --git a/tests/Feature/Fields/Relationships/BelongsToManyFieldTest.php b/tests/Feature/Fields/Relationships/BelongsToManyFieldTest.php index b77a11cfe..4be9e328c 100644 --- a/tests/Feature/Fields/Relationships/BelongsToManyFieldTest.php +++ b/tests/Feature/Fields/Relationships/BelongsToManyFieldTest.php @@ -49,7 +49,7 @@ function testBelongsToManyValue(TestResource $resource, Item $item, array $data, ]])->sort()->toArray(); }; - if(!is_null($pivotData)) { + if(! is_null($pivotData)) { $data = $mapper($data, $pivotData); } @@ -128,7 +128,7 @@ function testBelongsToManyValue(TestResource $resource, Item $item, array $data, testBelongsToManyValue($resource, $this->item, $data, pivotData: $pivotData); - $this->item->categories->each(function ($category) use($file) { + $this->item->categories->each(function ($category) use ($file) { expect($category->pivot->pivot_1) ->toBe('test 1') ->and($category->pivot->pivot_2) @@ -208,7 +208,7 @@ function testBelongsToManyValue(TestResource $resource, Item $item, array $data, testBelongsToManyValue($resource, $this->item, $data, pivotData: $pivotData); - $this->item->categories->each(function ($category) use($file) { + $this->item->categories->each(function ($category) use ($file) { expect($category->pivot->pivot_1) ->toBe('test 1') ->and($category->pivot->pivot_2) diff --git a/tests/Feature/Fields/TempateFieldTest.php b/tests/Feature/Fields/TempateFieldTest.php index 7e1cc41da..e31686863 100644 --- a/tests/Feature/Fields/TempateFieldTest.php +++ b/tests/Feature/Fields/TempateFieldTest.php @@ -38,16 +38,16 @@ function baseTemplateSaveFile(Item $item, ?UploadedFile $changedFile = null, ?ar $resource = addFieldsToTestResource( Template::make('Data') ->fields([ - File::make('File') + File::make('File'), ]) - ->changeFill(fn(Item $data, Template $field) => data_get($data, $field->getColumn(), [])) + ->changeFill(fn (Item $data, Template $field) => data_get($data, $field->getColumn(), [])) ->onApply(onApply: function (Item $item, $value, Template $field) { $column = $field->getColumn(); $applyValues = []; foreach ($field->getPreparedFields() as $f) { $apply = $f->apply( - fn($data): mixed => data_set($data, $f->getColumn(), $value[$f->getColumn()] ?? ''), + fn ($data): mixed => data_set($data, $f->getColumn(), $value[$f->getColumn()] ?? ''), $value ); @@ -80,7 +80,7 @@ function baseTemplateIterableSaveFile(Item $item, ?UploadedFile $changedFile = n ->fields([ File::make('File'), ]) - ->changeFill(fn(Item $data, Template $field) => data_get($data, $field->getColumn(), [])) + ->changeFill(fn (Item $data, Template $field) => data_get($data, $field->getColumn(), [])) ->onApply(onApply: function (Item $item, $values, Template $field) { $column = $field->getColumn(); $applyValues = []; @@ -90,7 +90,7 @@ function baseTemplateIterableSaveFile(Item $item, ?UploadedFile $changedFile = n $f->setNameIndex($index); $apply = $f->apply( - fn($data): mixed => data_set($data, $f->getColumn(), $value[$f->getColumn()] ?? ''), + fn ($data): mixed => data_set($data, $f->getColumn(), $value[$f->getColumn()] ?? ''), $value ); @@ -113,11 +113,11 @@ function baseTemplateIterableSaveFile(Item $item, ?UploadedFile $changedFile = n $file = $changedFile ?? UploadedFile::fake()->create('test.csv'); $data = $changedData ?? [ - ['file' => $file] + ['file' => $file], ]; testTemplateValue($resource, $item, $data, [ - ['file' => $file->hashName()] + ['file' => $file->hashName()], ]); } @@ -149,7 +149,7 @@ function baseTemplateIterableSaveFile(Item $item, ?UploadedFile $changedFile = n $file = UploadedFile::fake()->create('test.csv'); $data = [ - ['hidden_file' => $file->hashName()] + ['hidden_file' => $file->hashName()], ]; baseTemplateIterableSaveFile($this->item, $file, $data);