From bfdc223f5ce9fd08c47ed0cf0500b7a61190c39e Mon Sep 17 00:00:00 2001 From: rawilk Date: Fri, 17 Nov 2023 16:12:44 +0000 Subject: [PATCH] PHP Linting (Pint) --- src/Components/Choice/Checkbox.php | 6 +-- src/Components/Choice/SwitchToggle.php | 4 +- src/Components/Files/FilePond.php | 8 +-- src/Components/Files/FileUpload.php | 10 ++-- src/Components/FormGroup.php | 5 +- src/Components/Inputs/CustomSelect.php | 14 ++--- src/Components/Inputs/DatePicker.php | 24 ++++----- src/Components/Inputs/Input.php | 18 +++---- src/Components/Inputs/Password.php | 24 ++++----- src/Components/Inputs/Select.php | 24 ++++----- src/Components/Inputs/Textarea.php | 24 ++++----- src/Components/Inputs/TimezoneSelect.php | 26 +++++----- src/Components/Inputs/TreeSelect.php | 52 +++++++++---------- .../Concerns/HandlesSelectOptions.php | 2 +- src/Components/RichText/Quill.php | 2 +- src/Concerns/GetsSelectOptionProperties.php | 12 ++--- src/Dto/QuillOptions.php | 2 +- src/FormComponentsServiceProvider.php | 5 +- tests/Components/Choice/CheckboxGroupTest.php | 3 +- tests/Components/Choice/CheckboxTest.php | 3 +- tests/Components/Choice/RadioTest.php | 3 +- tests/Components/Choice/SwitchToggleTest.php | 3 +- tests/Components/ComponentPrefixTest.php | 3 +- tests/Components/Files/FilePondTest.php | 3 +- tests/Components/Files/FileUploadTest.php | 3 +- tests/Components/FormErrorTest.php | 3 +- tests/Components/FormGroupTest.php | 3 +- tests/Components/FormTest.php | 3 +- .../Inputs/CustomSelectOptionTest.php | 3 +- tests/Components/Inputs/CustomSelectTest.php | 3 +- tests/Components/Inputs/DatePickerTest.php | 3 +- tests/Components/Inputs/EmailTest.php | 3 +- tests/Components/Inputs/InputTest.php | 3 +- tests/Components/Inputs/PasswordTest.php | 3 +- tests/Components/Inputs/SelectTest.php | 3 +- tests/Components/Inputs/TextareaTest.php | 3 +- .../Components/Inputs/TimezoneSelectTest.php | 3 +- .../Inputs/TreeSelectOptionTest.php | 3 +- tests/Components/Inputs/TreeSelectTest.php | 3 +- tests/Components/LabelTest.php | 3 +- 40 files changed, 176 insertions(+), 152 deletions(-) diff --git a/src/Components/Choice/Checkbox.php b/src/Components/Choice/Checkbox.php index 0bbaf76..2df2f91 100644 --- a/src/Components/Choice/Checkbox.php +++ b/src/Components/Choice/Checkbox.php @@ -16,8 +16,8 @@ class Checkbox extends BladeComponent use HandlesValidationErrors { ariaDescribedBy as validationAriaDescribedBy; } - use HasModels; use HasExtraAttributes; + use HasModels; public string $type = 'checkbox'; @@ -34,7 +34,7 @@ public function __construct( public ?bool $labelLeft = null, // Extra Attributes - null|string|HtmlString|array|Collection $extraAttributes = null, + string|HtmlString|array|Collection $extraAttributes = null, ) { $this->id = $id ?? $name; @@ -57,7 +57,7 @@ public function inputClass(): string ]); } - public function containerClass(?string $inputSize = null): string + public function containerClass(string $inputSize = null): string { // Input size from parent has priority over individual defined size. if ($inputSize) { diff --git a/src/Components/Choice/SwitchToggle.php b/src/Components/Choice/SwitchToggle.php index b19a6a1..9907096 100644 --- a/src/Components/Choice/SwitchToggle.php +++ b/src/Components/Choice/SwitchToggle.php @@ -15,8 +15,8 @@ class SwitchToggle extends BladeComponent { use HandlesValidationErrors; - use HasModels; use HasExtraAttributes; + use HasModels; public function __construct( public ?string $name = null, @@ -35,7 +35,7 @@ public function __construct( public bool $short = false, // Extra Attributes - null|string|HtmlString|array|Collection $extraAttributes = null, + string|HtmlString|array|Collection $extraAttributes = null, ) { $this->id = $id ?? $name; diff --git a/src/Components/Files/FilePond.php b/src/Components/Files/FilePond.php index dd95810..aa9f50a 100644 --- a/src/Components/Files/FilePond.php +++ b/src/Components/Files/FilePond.php @@ -14,8 +14,8 @@ class FilePond extends BladeComponent { - use HandlesValidationErrors; use AcceptsFiles; + use HandlesValidationErrors; use HasExtraAttributes; use HasModels; @@ -28,11 +28,11 @@ public function __construct( public ?int $maxFiles = null, public ?array $options = null, public ?string $description = null, - ?string $type = null, - ?bool $showErrors = null, + string $type = null, + bool $showErrors = null, // Extra attributes - null|string|HtmlString|array|Collection $extraAttributes = null, + string|HtmlString|array|Collection $extraAttributes = null, ) { $this->id = $id ?? $name; diff --git a/src/Components/Files/FileUpload.php b/src/Components/Files/FileUpload.php index e2c9bf6..e7b2d0c 100644 --- a/src/Components/Files/FileUpload.php +++ b/src/Components/Files/FileUpload.php @@ -15,10 +15,10 @@ class FileUpload extends BladeComponent { - use HandlesValidationErrors; use AcceptsFiles; - use HasModels; + use HandlesValidationErrors; use HasExtraAttributes; + use HasModels; protected ?bool $canShowUploadProgress = null; @@ -26,15 +26,15 @@ public function __construct( public ?string $name = null, public ?string $id = null, public bool $multiple = false, - ?string $type = null, - ?bool $showErrors = null, + string $type = null, + bool $showErrors = null, public ?bool $displayUploadProgress = null, public ?string $size = null, public ?string $containerClass = null, public ?bool $useNativeProgressBar = null, // Extra attributes - null|string|HtmlString|array|Collection $extraAttributes = null, + string|HtmlString|array|Collection $extraAttributes = null, ) { $this->id = $id ?? $name; $this->type = $type; diff --git a/src/Components/FormGroup.php b/src/Components/FormGroup.php index 16e7778..fd187bf 100644 --- a/src/Components/FormGroup.php +++ b/src/Components/FormGroup.php @@ -2,10 +2,11 @@ namespace Rawilk\FormComponents\Components; -use function config; use Illuminate\Support\Arr; use Rawilk\FormComponents\Concerns\HandlesValidationErrors; +use function config; + class FormGroup extends BladeComponent { use HandlesValidationErrors; @@ -15,7 +16,7 @@ public function __construct( public ?string $inputId = null, public null|bool|string $label = null, public ?bool $inline = null, - ?bool $showErrors = null, + bool $showErrors = null, public ?string $helpText = null, public bool $isCheckboxGroup = false, public ?bool $marginBottom = null, diff --git a/src/Components/Inputs/CustomSelect.php b/src/Components/Inputs/CustomSelect.php index 0eabd2e..e0665d0 100644 --- a/src/Components/Inputs/CustomSelect.php +++ b/src/Components/Inputs/CustomSelect.php @@ -18,15 +18,15 @@ class CustomSelect extends BladeComponent { use HandlesValidationErrors; + use HasAddons; use HasExtraAttributes; use HasModels; - use HasAddons; public function __construct( public ?string $name = null, public ?string $id = null, public mixed $value = null, - ?bool $showErrors = null, + bool $showErrors = null, public bool $multiple = false, public array|Collection $options = [], public ?string $size = null, @@ -51,13 +51,13 @@ public function __construct( public ?string $containerClass = null, // Extra Attributes - null|string|HtmlString|array|Collection $extraAttributes = null, + string|HtmlString|array|Collection $extraAttributes = null, // Addons - ?string $leadingAddon = null, - ?string $leadingIcon = null, - ?string $inlineAddon = null, - ?string $trailingAddon = null, + string $leadingAddon = null, + string $leadingIcon = null, + string $inlineAddon = null, + string $trailingAddon = null, ) { $this->id = $id ?? $name; $this->value = $name ? old($name, $value) : $value; diff --git a/src/Components/Inputs/DatePicker.php b/src/Components/Inputs/DatePicker.php index 2c29fae..5c096e7 100644 --- a/src/Components/Inputs/DatePicker.php +++ b/src/Components/Inputs/DatePicker.php @@ -11,23 +11,23 @@ class DatePicker extends Input { public function __construct( - ?string $name = null, - ?string $id = null, + string $name = null, + string $id = null, mixed $value = null, - ?string $containerClass = null, - ?string $size = null, - ?bool $showErrors = null, + string $containerClass = null, + string $size = null, + bool $showErrors = null, // Extra Attributes - null|HtmlString|array|string|Collection $extraAttributes = null, + HtmlString|array|string|Collection $extraAttributes = null, // Addons - ?string $leadingAddon = null, - ?string $leadingIcon = null, - ?string $inlineAddon = null, - ?string $trailingAddon = null, - ?string $trailingInlineAddon = null, - ?string $trailingIcon = null, + string $leadingAddon = null, + string $leadingIcon = null, + string $inlineAddon = null, + string $trailingAddon = null, + string $trailingInlineAddon = null, + string $trailingIcon = null, // Date picker specific public array $options = [], diff --git a/src/Components/Inputs/Input.php b/src/Components/Inputs/Input.php index c0a2a53..1373f84 100644 --- a/src/Components/Inputs/Input.php +++ b/src/Components/Inputs/Input.php @@ -16,9 +16,9 @@ class Input extends BladeComponent { use HandlesValidationErrors; + use HasAddons; use HasExtraAttributes; use HasModels; - use HasAddons; /** * Normally we want arrays to be encoded, but some components don't need that, like Select. @@ -32,18 +32,18 @@ public function __construct( public mixed $value = null, public ?string $containerClass = null, public ?string $size = null, - ?bool $showErrors = null, + bool $showErrors = null, // Extra Attributes - null|string|HtmlString|array|Collection $extraAttributes = null, + string|HtmlString|array|Collection $extraAttributes = null, // Addons - ?string $leadingAddon = null, - ?string $leadingIcon = null, - ?string $inlineAddon = null, - ?string $trailingAddon = null, - ?string $trailingInlineAddon = null, - ?string $trailingIcon = null, + string $leadingAddon = null, + string $leadingIcon = null, + string $inlineAddon = null, + string $trailingAddon = null, + string $trailingInlineAddon = null, + string $trailingIcon = null, ) { $this->id = $this->id ?? $this->name; $this->value = $name ? old($name, $value) : $value; diff --git a/src/Components/Inputs/Password.php b/src/Components/Inputs/Password.php index b815451..9701dd1 100644 --- a/src/Components/Inputs/Password.php +++ b/src/Components/Inputs/Password.php @@ -11,23 +11,23 @@ class Password extends Input { public function __construct( - ?string $name = null, - ?string $id = null, + string $name = null, + string $id = null, mixed $value = null, - ?string $containerClass = null, - ?string $size = null, - ?bool $showErrors = null, + string $containerClass = null, + string $size = null, + bool $showErrors = null, // Extra Attributes - null|HtmlString|array|string|Collection $extraAttributes = null, + HtmlString|array|string|Collection $extraAttributes = null, // Addons - ?string $leadingAddon = null, - ?string $leadingIcon = null, - ?string $inlineAddon = null, - ?string $trailingAddon = null, - ?string $trailingInlineAddon = null, - ?string $trailingIcon = null, + string $leadingAddon = null, + string $leadingIcon = null, + string $inlineAddon = null, + string $trailingAddon = null, + string $trailingInlineAddon = null, + string $trailingIcon = null, // Password specific public ?bool $showToggle = null, diff --git a/src/Components/Inputs/Select.php b/src/Components/Inputs/Select.php index 1808656..9e56f84 100644 --- a/src/Components/Inputs/Select.php +++ b/src/Components/Inputs/Select.php @@ -13,23 +13,23 @@ class Select extends Input use GetsSelectOptionProperties; public function __construct( - ?string $name = null, - ?string $id = null, + string $name = null, + string $id = null, mixed $value = null, - ?string $containerClass = null, - ?string $size = null, - ?bool $showErrors = null, + string $containerClass = null, + string $size = null, + bool $showErrors = null, // Extra attributes - null|HtmlString|array|string|Collection $extraAttributes = null, + HtmlString|array|string|Collection $extraAttributes = null, // Addons - ?string $leadingAddon = null, - ?string $leadingIcon = null, - ?string $inlineAddon = null, - ?string $trailingAddon = null, - ?string $trailingInlineAddon = null, - ?string $trailingIcon = null, + string $leadingAddon = null, + string $leadingIcon = null, + string $inlineAddon = null, + string $trailingAddon = null, + string $trailingInlineAddon = null, + string $trailingIcon = null, // Select specific public bool $multiple = false, diff --git a/src/Components/Inputs/Textarea.php b/src/Components/Inputs/Textarea.php index a963a0c..b0d8302 100644 --- a/src/Components/Inputs/Textarea.php +++ b/src/Components/Inputs/Textarea.php @@ -9,23 +9,23 @@ class Textarea extends Input { public function __construct( - ?string $name = null, - ?string $id = null, + string $name = null, + string $id = null, mixed $value = null, - ?string $containerClass = null, - ?string $size = null, - ?bool $showErrors = null, + string $containerClass = null, + string $size = null, + bool $showErrors = null, // Extra attributes - null|HtmlString|array|string|Collection $extraAttributes = null, + HtmlString|array|string|Collection $extraAttributes = null, // Addons - ?string $leadingAddon = null, - ?string $leadingIcon = null, - ?string $inlineAddon = null, - ?string $trailingAddon = null, - ?string $trailingInlineAddon = null, - ?string $trailingIcon = null, + string $leadingAddon = null, + string $leadingIcon = null, + string $inlineAddon = null, + string $trailingAddon = null, + string $trailingInlineAddon = null, + string $trailingIcon = null, // Textarea specific public ?bool $autoResize = null, diff --git a/src/Components/Inputs/TimezoneSelect.php b/src/Components/Inputs/TimezoneSelect.php index f3db25b..2504738 100644 --- a/src/Components/Inputs/TimezoneSelect.php +++ b/src/Components/Inputs/TimezoneSelect.php @@ -10,23 +10,23 @@ class TimezoneSelect extends Select { public function __construct( - ?string $name = null, - ?string $id = null, + string $name = null, + string $id = null, mixed $value = null, - ?string $containerClass = null, - ?string $size = null, - ?bool $showErrors = null, + string $containerClass = null, + string $size = null, + bool $showErrors = null, // Extra Attributes - null|HtmlString|array|string|Collection $extraAttributes = null, + HtmlString|array|string|Collection $extraAttributes = null, // Addons - ?string $leadingAddon = null, - ?string $leadingIcon = null, - ?string $inlineAddon = null, - ?string $trailingAddon = null, - ?string $trailingInlineAddon = null, - ?string $trailingIcon = null, + string $leadingAddon = null, + string $leadingIcon = null, + string $inlineAddon = null, + string $trailingAddon = null, + string $trailingInlineAddon = null, + string $trailingIcon = null, bool $multiple = false, array|Collection $options = [], @@ -45,7 +45,7 @@ public function __construct( public ?string $optionSelectedIcon = null, // Timezone specific - null|array|string|bool $only = null, + array|string|bool $only = null, ) { parent::__construct( name: $name, diff --git a/src/Components/Inputs/TreeSelect.php b/src/Components/Inputs/TreeSelect.php index e1ebbee..da47e8f 100644 --- a/src/Components/Inputs/TreeSelect.php +++ b/src/Components/Inputs/TreeSelect.php @@ -10,40 +10,40 @@ class TreeSelect extends CustomSelect { public function __construct( - ?string $name = null, - ?string $id = null, + string $name = null, + string $id = null, mixed $value = null, - ?bool $showErrors = null, + bool $showErrors = null, bool $multiple = false, array|Collection $options = [], - ?string $size = null, - ?string $valueField = null, - ?string $labelField = null, - ?string $selectedLabelField = null, - ?string $disabledField = null, - ?string $childrenField = null, - ?int $minSelected = null, - ?int $maxSelected = null, - ?bool $optional = null, - ?string $buttonIcon = null, - ?bool $searchable = null, - ?string $livewireSearch = null, - ?bool $clearable = null, - ?string $clearIcon = null, - ?string $optionSelectedIcon = null, - ?string $placeholder = null, - ?string $noResultsText = null, - ?string $noOptionsText = null, + string $size = null, + string $valueField = null, + string $labelField = null, + string $selectedLabelField = null, + string $disabledField = null, + string $childrenField = null, + int $minSelected = null, + int $maxSelected = null, + bool $optional = null, + string $buttonIcon = null, + bool $searchable = null, + string $livewireSearch = null, + bool $clearable = null, + string $clearIcon = null, + string $optionSelectedIcon = null, + string $placeholder = null, + string $noResultsText = null, + string $noOptionsText = null, bool $alwaysOpen = false, // Extra Attributes - null|HtmlString|array|string|Collection $extraAttributes = null, + HtmlString|array|string|Collection $extraAttributes = null, // Addons - ?string $leadingAddon = null, - ?string $leadingIcon = null, - ?string $inlineAddon = null, - ?string $trailingAddon = null, + string $leadingAddon = null, + string $leadingIcon = null, + string $inlineAddon = null, + string $trailingAddon = null, // Tree select specific public ?string $hasChildIcon = null, diff --git a/src/Components/Livewire/Concerns/HandlesSelectOptions.php b/src/Components/Livewire/Concerns/HandlesSelectOptions.php index 8389b16..aeb8f22 100644 --- a/src/Components/Livewire/Concerns/HandlesSelectOptions.php +++ b/src/Components/Livewire/Concerns/HandlesSelectOptions.php @@ -23,7 +23,7 @@ public function handleSearch(?string $search): void $this->search = $search; } - public function options(?string $search = null) + public function options(string $search = null) { return collect(); } diff --git a/src/Components/RichText/Quill.php b/src/Components/RichText/Quill.php index 56a1a7b..a135941 100644 --- a/src/Components/RichText/Quill.php +++ b/src/Components/RichText/Quill.php @@ -20,7 +20,7 @@ public function __construct( public ?string $name = null, public ?string $id = null, public ?string $value = null, - ?bool $showErrors = null, + bool $showErrors = null, public ?bool $autoFocus = null, public bool $readonly = false, public ?string $placeholder = null, diff --git a/src/Concerns/GetsSelectOptionProperties.php b/src/Concerns/GetsSelectOptionProperties.php index 3cc0054..910e956 100644 --- a/src/Concerns/GetsSelectOptionProperties.php +++ b/src/Concerns/GetsSelectOptionProperties.php @@ -15,12 +15,12 @@ */ trait GetsSelectOptionProperties { - public function optionChildren($option, ?string $childrenField = null) + public function optionChildren($option, string $childrenField = null) { return $this->optionProperty($option, $childrenField ?? $this->childrenField, []); } - public function optionLabel($option, ?string $labelField = null, ?string $valueField = null) + public function optionLabel($option, string $labelField = null, string $valueField = null) { return $this->optionProperty( $option, @@ -29,7 +29,7 @@ public function optionLabel($option, ?string $labelField = null, ?string $valueF ); } - public function optionSelectedLabel($option, ?string $selectedLabelField = null, ?string $labelField = null, ?string $valueField = null) + public function optionSelectedLabel($option, string $selectedLabelField = null, string $labelField = null, string $valueField = null) { return $this->optionProperty( $option, @@ -38,19 +38,19 @@ public function optionSelectedLabel($option, ?string $selectedLabelField = null, ); } - public function optionValue($option, ?string $valueField = null) + public function optionValue($option, string $valueField = null) { return $this->optionProperty($option, $valueField ?? $this->valueField); } - public function optionIsDisabled($option, ?string $disabledField = null): bool + public function optionIsDisabled($option, string $disabledField = null): bool { $disabled = $this->optionProperty($option, $disabledField ?? $this->disabledField, false); return is_bool($disabled) ? $disabled : false; } - public function optionIsOptGroup($option, ?string $childrenField = null): bool + public function optionIsOptGroup($option, string $childrenField = null): bool { // We will consider an option an "opt group" if it has children. $children = $this->optionChildren($option, $childrenField); diff --git a/src/Dto/QuillOptions.php b/src/Dto/QuillOptions.php index 5f7e4d8..47d1493 100644 --- a/src/Dto/QuillOptions.php +++ b/src/Dto/QuillOptions.php @@ -67,7 +67,7 @@ public static function make(): self return new self; } - public static function defaults(?callable $callback = null): ?self + public static function defaults(callable $callback = null): ?self { if (is_null($callback)) { return static::default(); diff --git a/src/FormComponentsServiceProvider.php b/src/FormComponentsServiceProvider.php index 6828510..2827225 100644 --- a/src/FormComponentsServiceProvider.php +++ b/src/FormComponentsServiceProvider.php @@ -4,18 +4,19 @@ namespace Rawilk\FormComponents; -use function app; use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; use Illuminate\View\Compilers\BladeCompiler; use Illuminate\View\ComponentAttributeBag; -use function method_exists; use Rawilk\FormComponents\Controllers\FormComponentsJavaScriptAssets; use Rawilk\FormComponents\Support\FormComponentsTagCompiler; use Rawilk\FormComponents\Support\Timezone; use Spatie\LaravelPackageTools\Package; use Spatie\LaravelPackageTools\PackageServiceProvider; +use function app; +use function method_exists; + class FormComponentsServiceProvider extends PackageServiceProvider { public function configurePackage(Package $package): void diff --git a/tests/Components/Choice/CheckboxGroupTest.php b/tests/Components/Choice/CheckboxGroupTest.php index 1da3457..7a8181c 100644 --- a/tests/Components/Choice/CheckboxGroupTest.php +++ b/tests/Components/Choice/CheckboxGroupTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + beforeEach(function () { config()->set('form-components.defaults.choice.size', null); }); diff --git a/tests/Components/Choice/CheckboxTest.php b/tests/Components/Choice/CheckboxTest.php index 4487a9a..0373aa7 100644 --- a/tests/Components/Choice/CheckboxTest.php +++ b/tests/Components/Choice/CheckboxTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + beforeEach(function () { config()->set('form-components.defaults.choice', [ 'container_class' => null, diff --git a/tests/Components/Choice/RadioTest.php b/tests/Components/Choice/RadioTest.php index ed56983..4bec460 100644 --- a/tests/Components/Choice/RadioTest.php +++ b/tests/Components/Choice/RadioTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + beforeEach(function () { config()->set('form-components.defaults.choice', [ 'container_class' => null, diff --git a/tests/Components/Choice/SwitchToggleTest.php b/tests/Components/Choice/SwitchToggleTest.php index 298119b..d693b74 100644 --- a/tests/Components/Choice/SwitchToggleTest.php +++ b/tests/Components/Choice/SwitchToggleTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + beforeEach(function () { config()->set('form-components.defaults.switch_toggle', [ 'container_class' => null, diff --git a/tests/Components/ComponentPrefixTest.php b/tests/Components/ComponentPrefixTest.php index 13994f6..f3c6f7e 100644 --- a/tests/Components/ComponentPrefixTest.php +++ b/tests/Components/ComponentPrefixTest.php @@ -4,10 +4,11 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Rawilk\FormComponents\Tests\Components\Support\SetsComponentPrefix; use Sinnbeck\DomAssertions\Asserts\AssertForm; +use function Pest\Laravel\get; + uses(SetsComponentPrefix::class); test('a custom prefix can be used', function () { diff --git a/tests/Components/Files/FilePondTest.php b/tests/Components/Files/FilePondTest.php index 23830ec..df3b57f 100644 --- a/tests/Components/Files/FilePondTest.php +++ b/tests/Components/Files/FilePondTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + it('can be rendered', function () { Route::get('/test', fn () => Blade::render('')); diff --git a/tests/Components/Files/FileUploadTest.php b/tests/Components/Files/FileUploadTest.php index 1f7ad01..dac6159 100644 --- a/tests/Components/Files/FileUploadTest.php +++ b/tests/Components/Files/FileUploadTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + beforeEach(function () { config()->set('form-components.defaults.file-upload', [ 'container_class' => null, diff --git a/tests/Components/FormErrorTest.php b/tests/Components/FormErrorTest.php index 3310551..9788918 100644 --- a/tests/Components/FormErrorTest.php +++ b/tests/Components/FormErrorTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + it('can be rendered', function () { $this->withViewErrors(['first_name' => 'Name is required']); diff --git a/tests/Components/FormGroupTest.php b/tests/Components/FormGroupTest.php index 0c8a02a..16c91b5 100644 --- a/tests/Components/FormGroupTest.php +++ b/tests/Components/FormGroupTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + it('can be rendered', function () { $template = <<<'HTML' diff --git a/tests/Components/FormTest.php b/tests/Components/FormTest.php index b16444b..67ce985 100644 --- a/tests/Components/FormTest.php +++ b/tests/Components/FormTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertForm; +use function Pest\Laravel\get; + it('renders a form', function () { $template = <<<'HTML' diff --git a/tests/Components/Inputs/CustomSelectOptionTest.php b/tests/Components/Inputs/CustomSelectOptionTest.php index 595f627..1e5e15b 100644 --- a/tests/Components/Inputs/CustomSelectOptionTest.php +++ b/tests/Components/Inputs/CustomSelectOptionTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + beforeEach(function () { config()->set('form-components.defaults.custom_select', [ 'container_class' => null, diff --git a/tests/Components/Inputs/CustomSelectTest.php b/tests/Components/Inputs/CustomSelectTest.php index 25ee262..5fb0ddc 100644 --- a/tests/Components/Inputs/CustomSelectTest.php +++ b/tests/Components/Inputs/CustomSelectTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + beforeEach(function () { config()->set('form-components.defaults.custom_select', [ 'container_class' => null, diff --git a/tests/Components/Inputs/DatePickerTest.php b/tests/Components/Inputs/DatePickerTest.php index eb0a9e1..87b7e29 100644 --- a/tests/Components/Inputs/DatePickerTest.php +++ b/tests/Components/Inputs/DatePickerTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + beforeEach(function () { config()->set('form-components.defaults.date_picker', [ 'clear_icon' => null, diff --git a/tests/Components/Inputs/EmailTest.php b/tests/Components/Inputs/EmailTest.php index 8caf355..912123e 100644 --- a/tests/Components/Inputs/EmailTest.php +++ b/tests/Components/Inputs/EmailTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + it('can be rendered', function () { Route::get('/test', fn () => Blade::render('')); diff --git a/tests/Components/Inputs/InputTest.php b/tests/Components/Inputs/InputTest.php index 8213228..ed57992 100644 --- a/tests/Components/Inputs/InputTest.php +++ b/tests/Components/Inputs/InputTest.php @@ -5,9 +5,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; use Illuminate\Support\HtmlString; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + beforeEach(function () { config()->set('form-components.defaults.input', [ 'size' => 'md', diff --git a/tests/Components/Inputs/PasswordTest.php b/tests/Components/Inputs/PasswordTest.php index d827e7c..571ddbd 100644 --- a/tests/Components/Inputs/PasswordTest.php +++ b/tests/Components/Inputs/PasswordTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + beforeEach(function () { config()->set('form-components.defaults.password', [ 'show_toggle' => true, diff --git a/tests/Components/Inputs/SelectTest.php b/tests/Components/Inputs/SelectTest.php index e7fa377..69a6c57 100644 --- a/tests/Components/Inputs/SelectTest.php +++ b/tests/Components/Inputs/SelectTest.php @@ -4,11 +4,12 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; use Sinnbeck\DomAssertions\Asserts\AssertForm; use Sinnbeck\DomAssertions\Asserts\AssertSelect; +use function Pest\Laravel\get; + beforeEach(function () { config()->set('form-components.defaults.select', [ 'input_class' => null, diff --git a/tests/Components/Inputs/TextareaTest.php b/tests/Components/Inputs/TextareaTest.php index 8d62c02..8e9aa47 100644 --- a/tests/Components/Inputs/TextareaTest.php +++ b/tests/Components/Inputs/TextareaTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + beforeEach(function () { config()->set('form-components.defaults.textarea', [ 'rows' => 3, diff --git a/tests/Components/Inputs/TimezoneSelectTest.php b/tests/Components/Inputs/TimezoneSelectTest.php index c805304..0227933 100644 --- a/tests/Components/Inputs/TimezoneSelectTest.php +++ b/tests/Components/Inputs/TimezoneSelectTest.php @@ -4,13 +4,14 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Rawilk\FormComponents\Support\TimeZoneRegion; use Rawilk\FormComponents\Support\TimeZoneRegionEnum; use Sinnbeck\DomAssertions\Asserts\AssertElement; use Sinnbeck\DomAssertions\Asserts\AssertForm; use Sinnbeck\DomAssertions\Asserts\AssertSelect; +use function Pest\Laravel\get; + beforeEach(function () { config()->set('form-components.defaults.custom_select', [ 'container_class' => null, diff --git a/tests/Components/Inputs/TreeSelectOptionTest.php b/tests/Components/Inputs/TreeSelectOptionTest.php index 0b598e2..afdc92b 100644 --- a/tests/Components/Inputs/TreeSelectOptionTest.php +++ b/tests/Components/Inputs/TreeSelectOptionTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + beforeEach(function () { config()->set('form-components.defaults.custom_select', [ 'container_class' => null, diff --git a/tests/Components/Inputs/TreeSelectTest.php b/tests/Components/Inputs/TreeSelectTest.php index 069bbd7..8c59044 100644 --- a/tests/Components/Inputs/TreeSelectTest.php +++ b/tests/Components/Inputs/TreeSelectTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + beforeEach(function () { config()->set('form-components.defaults.custom_select', [ 'container_class' => null, diff --git a/tests/Components/LabelTest.php b/tests/Components/LabelTest.php index afda3ea..5758d3f 100644 --- a/tests/Components/LabelTest.php +++ b/tests/Components/LabelTest.php @@ -4,9 +4,10 @@ use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Route; -use function Pest\Laravel\get; use Sinnbeck\DomAssertions\Asserts\AssertElement; +use function Pest\Laravel\get; + it('can render a label', function () { Route::get('/test', fn () => Blade::render(''));