@@ -112,6 +112,10 @@ final class Field
112112 private bool $ available = true ;
113113
114114 private Closure |string |null $ map = null ;
115+
116+ /**
117+ * @var class-string<object>|null
118+ */
115119 private ?string $ source = null ;
116120
117121 public function __construct (
@@ -121,6 +125,9 @@ public function __construct(
121125 ) {
122126 }
123127
128+ /**
129+ * @return array<string>
130+ */
124131 public function rules (): array
125132 {
126133 return $ this ->rules ->all ();
@@ -136,11 +143,17 @@ public function isAvailable(): bool
136143 return $ this ->available ;
137144 }
138145
146+ /**
147+ * @param class-string<object> $source
148+ */
139149 public function setSource (string $ source ): void
140150 {
141151 $ this ->source = $ source ;
142152 }
143153
154+ /**
155+ * @return class-string<object>|null
156+ */
144157 public function getSource (): ?string
145158 {
146159 return $ this ->source ;
@@ -174,9 +187,11 @@ private function is(array $haystack, string $needle): bool
174187 return in_array ($ needle , $ haystack , true );
175188 }
176189
177- private function handleMapping (Closure | string $ map ): void
190+ private function handleMapping (mixed $ mapping ): void
178191 {
179- $ this ->map = $ map ;
192+ if ($ mapping instanceof Closure || is_string ($ mapping )) {
193+ $ this ->map = $ mapping ;
194+ }
180195 }
181196
182197 private function handleVisibility (string $ name ): void
0 commit comments