You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Schema/CustomField.php
+33-14Lines changed: 33 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -18,34 +18,50 @@
18
18
19
19
usefunctionpreg_match;
20
20
21
+
/**
22
+
* @template T
23
+
*/
21
24
finalclass CustomField extends AbstractField
22
25
{
23
-
/**
24
-
* The closure MUST return null if it fails to parse the value.
25
-
* It should return the parsed value according to
26
-
* the callable logic.
27
-
*
28
-
* @var Closure(mixed): ?mixed
29
-
*/
30
-
privatereadonlyClosure$parser;
26
+
privatereadonlyFieldParser$parser;
31
27
/** @var non-empty-string */
32
28
publicreadonlystring$name;
33
29
34
30
publicfunction__construct(
35
-
callable$parser,
31
+
FieldParser|Closure|callable$parser,
36
32
string$name,
37
33
float$confidenceThreshold = 0.8
38
34
) {
39
35
('' !== $name && 1 === preg_match('/^[a-z]+(?:_[a-z0-9]+)*$/', $name)) || thrownewValueError('The name "'.$name.'" is not a valid snake case variable name.');
0 commit comments