From ea8d4b18eec04b8b82050e99f0007a55a16679a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Zapletal?= Date: Mon, 22 Apr 2024 00:39:27 -0600 Subject: [PATCH] Removed named params --- src/Collection/WriteBuilder/Rule/AnyOfRule.php | 2 +- .../WriteBuilder/Rule/CallableRule.php | 2 +- src/Collection/WriteBuilder/Rule/EqualRule.php | 2 +- .../WriteBuilder/Rule/HourMinuteRule.php | 16 +++------------- src/Collection/WriteBuilder/Rule/MinRule.php | 2 +- src/Collection/WriteBuilder/Rule/PhoneCzRule.php | 2 +- src/Collection/WriteBuilder/Rule/RegexRule.php | 2 +- src/Collection/WriteBuilder/Rule/UniqueRule.php | 2 +- .../WriteBuilder/Rule/VideoLinkRule.php | 2 +- 9 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/Collection/WriteBuilder/Rule/AnyOfRule.php b/src/Collection/WriteBuilder/Rule/AnyOfRule.php index 6bff561..2b0af0c 100644 --- a/src/Collection/WriteBuilder/Rule/AnyOfRule.php +++ b/src/Collection/WriteBuilder/Rule/AnyOfRule.php @@ -15,7 +15,7 @@ public function __construct( protected ?string $message = null ) { - parent::__construct(message: $message); + parent::__construct($message); } public function message(): string diff --git a/src/Collection/WriteBuilder/Rule/CallableRule.php b/src/Collection/WriteBuilder/Rule/CallableRule.php index 44d3d22..b2ad78d 100644 --- a/src/Collection/WriteBuilder/Rule/CallableRule.php +++ b/src/Collection/WriteBuilder/Rule/CallableRule.php @@ -14,7 +14,7 @@ class CallableRule extends BaseRule protected array $callback; public function __construct( - callable $callback, + callable $callback, protected ?string $message = null, ) { diff --git a/src/Collection/WriteBuilder/Rule/EqualRule.php b/src/Collection/WriteBuilder/Rule/EqualRule.php index 77f4dcd..864efe8 100644 --- a/src/Collection/WriteBuilder/Rule/EqualRule.php +++ b/src/Collection/WriteBuilder/Rule/EqualRule.php @@ -12,7 +12,7 @@ public function __construct( protected ?string $message = null ) { - parent::__construct(message: $message); + parent::__construct($message); } public function message(): string diff --git a/src/Collection/WriteBuilder/Rule/HourMinuteRule.php b/src/Collection/WriteBuilder/Rule/HourMinuteRule.php index 9273df5..aa990a2 100644 --- a/src/Collection/WriteBuilder/Rule/HourMinuteRule.php +++ b/src/Collection/WriteBuilder/Rule/HourMinuteRule.php @@ -7,14 +7,6 @@ class HourMinuteRule extends BaseRule { - public function __construct( - protected ?string $message = null, - protected bool $normalize = true - ) - { - parent::__construct(message: $message); - } - public function message(): string { return $this->message ?: "Field must be a valid hour and minute in ISO format. Example: 07:00"; @@ -39,11 +31,9 @@ public function validate(): bool $date = \DateTime::createFromFormat('H:i', $value); if ($date instanceof \DateTime) { - if ($this->normalize) { - $date->setDate(1970, 1, 1); - $date->setTime((int)$date->format('H'), (int)$date->format('i')); - $this->field->setValue($date->format('Y-m-d H:i:s')); - } + $date->setDate(1970, 1, 1); + $date->setTime((int)$date->format('H'), (int)$date->format('i')); + $this->field->setValue($date->format('Y-m-d H:i:s')); return true; } diff --git a/src/Collection/WriteBuilder/Rule/MinRule.php b/src/Collection/WriteBuilder/Rule/MinRule.php index ff252a8..ff2daf3 100644 --- a/src/Collection/WriteBuilder/Rule/MinRule.php +++ b/src/Collection/WriteBuilder/Rule/MinRule.php @@ -12,7 +12,7 @@ public function __construct( protected ?string $message = null ) { - parent::__construct(message: $message); + parent::__construct($message); } public function message(): string diff --git a/src/Collection/WriteBuilder/Rule/PhoneCzRule.php b/src/Collection/WriteBuilder/Rule/PhoneCzRule.php index bf7fd10..cc59dc1 100644 --- a/src/Collection/WriteBuilder/Rule/PhoneCzRule.php +++ b/src/Collection/WriteBuilder/Rule/PhoneCzRule.php @@ -12,7 +12,7 @@ public function __construct( protected bool $normalize = true ) { - parent::__construct(message: $message); + parent::__construct($message); } public function message(): string diff --git a/src/Collection/WriteBuilder/Rule/RegexRule.php b/src/Collection/WriteBuilder/Rule/RegexRule.php index acf6ad4..62c9490 100644 --- a/src/Collection/WriteBuilder/Rule/RegexRule.php +++ b/src/Collection/WriteBuilder/Rule/RegexRule.php @@ -12,7 +12,7 @@ public function __construct( protected ?string $message = null ) { - parent::__construct(message: $message); + parent::__construct($message); } public function message(): string diff --git a/src/Collection/WriteBuilder/Rule/UniqueRule.php b/src/Collection/WriteBuilder/Rule/UniqueRule.php index bd8e1fa..96c8a3e 100644 --- a/src/Collection/WriteBuilder/Rule/UniqueRule.php +++ b/src/Collection/WriteBuilder/Rule/UniqueRule.php @@ -20,7 +20,7 @@ public function __construct( protected ?string $message = null ) { - parent::__construct(message: $message); + parent::__construct($message); } public function message(): string diff --git a/src/Collection/WriteBuilder/Rule/VideoLinkRule.php b/src/Collection/WriteBuilder/Rule/VideoLinkRule.php index 74595e1..ccb57a3 100644 --- a/src/Collection/WriteBuilder/Rule/VideoLinkRule.php +++ b/src/Collection/WriteBuilder/Rule/VideoLinkRule.php @@ -12,7 +12,7 @@ public function __construct( protected bool $normalize = true ) { - parent::__construct(message: $message); + parent::__construct($message); } public function message(): string