File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -70,9 +70,10 @@ protected function date(null|string|Closure $attribute = null): ValueDate
7070 }
7171
7272 /**
73+ * @template U
7374 * @param null|string|Closure(T):(array<mixed>|null) $attribute
7475 *
75- * @return ValueArray<T, mixed >
76+ * @return ValueArray<T, U >
7677 */
7778 protected function array (null |string |Closure $ attribute = null ): ValueArray
7879 {
@@ -90,9 +91,10 @@ protected function mixed(null|string|Closure $attribute = null): ValueMixed
9091 }
9192
9293 /**
94+ * @template U
9395 * @param null|string|Closure(T):mixed $attribute
9496 *
95- * @return ValueEnum<T>
97+ * @return ValueEnum<T, U >
9698 */
9799 protected function enum (null |string |Closure $ attribute = null ): ValueEnum
98100 {
Original file line number Diff line number Diff line change 88
99/**
1010 * @template T
11+ * @template U extends UnitEnum|BackedEnum
1112 * @extends Value<T>
1213 */
1314class ValueEnum extends Value
1415{
16+ /**
17+ * @var class-string<U>|null
18+ */
19+ protected null |string $ type = null ;
20+
21+ /**
22+ * Define the type of elements in the array
23+ *
24+ * @param class-string<U> $type
25+ * @return $this<T, U>
26+ */
27+ public function of (string $ type ): static
28+ {
29+ $ this ->type = $ type ;
30+ return $ this ;
31+ }
32+
1533 protected function value (mixed $ of , Request $ request ): mixed
1634 {
1735 if ($ of instanceof BackedEnum) return $ of ->value ;
You can’t perform that action at this time.
0 commit comments