File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 9
9
10
10
class Command
11
11
{
12
- protected static $ version = '1.0.4 ' ;
12
+ protected static $ version = '1.0.5 ' ;
13
13
14
14
protected array $ options = [];
15
15
@@ -104,6 +104,7 @@ protected function collect(): static
104
104
$ this ->climate ()->line ('<light_green>✓</light_green> added custom methods ' );
105
105
$ types ->withFieldMethods ();
106
106
$ types ->withTraitMethods ();
107
+ $ types ->withValidators ();
107
108
}
108
109
109
110
if ($ this ->include ('decorators ' )) {
Original file line number Diff line number Diff line change 12
12
use Kirby \Cms \HasMethods ;
13
13
use Kirby \Filesystem \F ;
14
14
use Kirby \Toolkit \A ;
15
+ use Kirby \Toolkit \V ;
15
16
use LukasKleinschmidt \Types \Methods \BlueprintMethod ;
16
17
use LukasKleinschmidt \Types \Methods \FieldMethod ;
17
18
use ReflectionClass ;
@@ -264,6 +265,17 @@ public function withTraitMethods(): void
264
265
}
265
266
}
266
267
268
+ public function withValidators (): void
269
+ {
270
+ $ target = new ReflectionClass (V::class);
271
+
272
+ foreach (V::$ validators as $ name => $ closure ) {
273
+ $ function = new ReflectionFunction ($ closure );
274
+
275
+ $ this ->pushMethod (new Method ($ function , $ target , $ name ));
276
+ }
277
+ }
278
+
267
279
public function addAliases (array $ aliases ): void
268
280
{
269
281
foreach ($ aliases as $ name => $ class ) {
You can’t perform that action at this time.
0 commit comments