From 092ebba98ba9c6b22e0b4776d951bf0f6fa8634c Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Wed, 21 Dec 2022 17:08:14 +0100 Subject: [PATCH] Deprecate field type range values as they add a lot of complexity See https://github.com/hydephp/develop/pull/685#issuecomment-1361565809 --- .../Features/Publications/Models/PublicationField.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/framework/src/Framework/Features/Publications/Models/PublicationField.php b/packages/framework/src/Framework/Features/Publications/Models/PublicationField.php index b9b216db68c..6bc382abcae 100644 --- a/packages/framework/src/Framework/Features/Publications/Models/PublicationField.php +++ b/packages/framework/src/Framework/Features/Publications/Models/PublicationField.php @@ -10,6 +10,7 @@ use Hyde\Support\Contracts\SerializableContract; use Illuminate\Support\Str; use InvalidArgumentException; +use JetBrains\PhpStorm\Deprecated; use Rgasch\Collection\Collection; use function strtolower; @@ -24,7 +25,9 @@ class PublicationField implements SerializableContract use Serializable; public readonly PublicationFieldTypes $type; + /** @deprecated https://github.com/hydephp/develop/pull/685#issuecomment-1361565809 */ public readonly string $max; + /** @deprecated https://github.com/hydephp/develop/pull/685#issuecomment-1361565809 */ public readonly string $min; public readonly string $name; public readonly ?string $tagGroup; @@ -35,7 +38,7 @@ public static function fromArray(array $array): static return new static(...$array); } - public function __construct(PublicationFieldTypes|string $type, string $name, int|string|null $min = '0', int|string|null $max = '0', ?string $tagGroup = null, PublicationType $publicationType = null) + public function __construct(PublicationFieldTypes|string $type, string $name, #[Deprecated] int|string|null $min = '0', #[Deprecated] int|string|null $max = '0', ?string $tagGroup = null, PublicationType $publicationType = null) { $this->type = $type instanceof PublicationFieldTypes ? $type : PublicationFieldTypes::from(strtolower($type)); $this->name = Str::kebab($name);