From 46ad00f33f464dec4fa05f251810bbac6071e3d8 Mon Sep 17 00:00:00 2001 From: Michael Aerni Date: Sat, 9 Dec 2023 13:19:10 -0500 Subject: [PATCH] No need to use static property for view --- src/Fields/Assets.php | 2 +- src/Fields/Captcha.php | 2 +- src/Fields/Checkboxes.php | 2 +- src/Fields/Hidden.php | 2 +- src/Fields/Honeypot.php | 2 +- src/Fields/Integer.php | 2 +- src/Fields/Properties/WithView.php | 6 +++--- src/Fields/Radio.php | 2 +- src/Fields/Select.php | 2 +- src/Fields/Spacer.php | 2 +- src/Fields/Text.php | 2 +- src/Fields/Textarea.php | 2 +- src/Fields/Toggle.php | 2 +- 13 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Fields/Assets.php b/src/Fields/Assets.php index 0452a0e7..78f5dad9 100644 --- a/src/Fields/Assets.php +++ b/src/Fields/Assets.php @@ -8,7 +8,7 @@ class Assets extends Field { use WithMultiple; - protected static string $view = 'assets'; + protected string $view = 'assets'; protected function multipleProperty(): bool { diff --git a/src/Fields/Captcha.php b/src/Fields/Captcha.php index 4dbc8e73..252111b2 100644 --- a/src/Fields/Captcha.php +++ b/src/Fields/Captcha.php @@ -4,7 +4,7 @@ class Captcha extends Field { - protected static string $view = 'captcha'; + protected string $view = 'captcha'; public function process(mixed $value): mixed { diff --git a/src/Fields/Checkboxes.php b/src/Fields/Checkboxes.php index e9f82113..a7d37649 100644 --- a/src/Fields/Checkboxes.php +++ b/src/Fields/Checkboxes.php @@ -10,7 +10,7 @@ class Checkboxes extends Field use WithInline; use WithOptions; - protected static string $view = 'checkboxes'; + protected string $view = 'checkboxes'; protected function defaultProperty(): string|array|null { diff --git a/src/Fields/Hidden.php b/src/Fields/Hidden.php index 00f3a767..b0511be7 100644 --- a/src/Fields/Hidden.php +++ b/src/Fields/Hidden.php @@ -4,5 +4,5 @@ class Hidden extends Field { - protected static string $view = 'default'; + protected string $view = 'default'; } diff --git a/src/Fields/Honeypot.php b/src/Fields/Honeypot.php index 1fea190f..6d22ed91 100644 --- a/src/Fields/Honeypot.php +++ b/src/Fields/Honeypot.php @@ -4,5 +4,5 @@ class Honeypot extends Field { - protected static string $view = 'honeypot'; + protected string $view = 'honeypot'; } diff --git a/src/Fields/Integer.php b/src/Fields/Integer.php index deed8acc..ed37ee6c 100644 --- a/src/Fields/Integer.php +++ b/src/Fields/Integer.php @@ -12,7 +12,7 @@ class Integer extends Field use WithInputType; use WithPlaceholder; - protected static string $view = 'default'; + protected string $view = 'default'; protected function inputTypeProperty(): string { diff --git a/src/Fields/Properties/WithView.php b/src/Fields/Properties/WithView.php index c86befb7..f64e8ba7 100644 --- a/src/Fields/Properties/WithView.php +++ b/src/Fields/Properties/WithView.php @@ -8,15 +8,15 @@ protected function viewProperty(): string { // Try to load a user-defined view first. if ($this->field->get('view')) { - return 'fields.'.$this->field->get('view'); + return "fields.{$this->field->get('view')}"; } // Try to autoload the view by field handle. if (view()->exists("livewire-forms::fields.{$this->handle}")) { - return 'fields.'.$this->handle; + return "fields.{$this->handle}"; } // Fall back to the default field view. - return 'fields.'.static::$view; + return "fields.{$this->view}"; } } diff --git a/src/Fields/Radio.php b/src/Fields/Radio.php index 87611ba2..47bcff34 100644 --- a/src/Fields/Radio.php +++ b/src/Fields/Radio.php @@ -12,7 +12,7 @@ class Radio extends Field use WithInline; use WithOptions; - protected static string $view = 'radio'; + protected string $view = 'radio'; protected function defaultProperty(): ?string { diff --git a/src/Fields/Select.php b/src/Fields/Select.php index 38d60cee..c5db9cab 100644 --- a/src/Fields/Select.php +++ b/src/Fields/Select.php @@ -16,7 +16,7 @@ class Select extends Field use WithOptions; use WithPlaceholder; - protected static string $view = 'select'; + protected string $view = 'select'; protected function defaultProperty(): string|array|null { diff --git a/src/Fields/Spacer.php b/src/Fields/Spacer.php index b3886b46..26450d5f 100644 --- a/src/Fields/Spacer.php +++ b/src/Fields/Spacer.php @@ -4,5 +4,5 @@ class Spacer extends Field { - protected static string $view = 'spacer'; + protected string $view = 'spacer'; } diff --git a/src/Fields/Text.php b/src/Fields/Text.php index b46f7dea..12032f46 100644 --- a/src/Fields/Text.php +++ b/src/Fields/Text.php @@ -12,7 +12,7 @@ class Text extends Field use WithInputType; use WithPlaceholder; - protected static string $view = 'default'; + protected string $view = 'default'; protected function hiddenProperty(): bool { diff --git a/src/Fields/Textarea.php b/src/Fields/Textarea.php index b3c5aca7..552d621a 100644 --- a/src/Fields/Textarea.php +++ b/src/Fields/Textarea.php @@ -12,5 +12,5 @@ class Textarea extends Field use WithPlaceholder; use WithRows; - protected static string $view = 'textarea'; + protected string $view = 'textarea'; } diff --git a/src/Fields/Toggle.php b/src/Fields/Toggle.php index 0f833c9b..fe101951 100644 --- a/src/Fields/Toggle.php +++ b/src/Fields/Toggle.php @@ -8,7 +8,7 @@ class Toggle extends Field { use WithInlineLabel; - protected static string $view = 'toggle'; + protected string $view = 'toggle'; protected function rulesProperty(): array {