@@ -102,7 +102,7 @@ abstract class AbstractFlag implements ArrayAccess, FlagInterface
102
102
* @param string $name
103
103
* @param string $desc
104
104
* @param string $type
105
- * @param bool $required
105
+ * @param bool $required
106
106
* @param mixed|null $default
107
107
*
108
108
* @return static
@@ -121,7 +121,7 @@ public static function new(
121
121
* Create by array define
122
122
*
123
123
* @param string $name
124
- * @param array $define
124
+ * @param array $define
125
125
*
126
126
* @return static
127
127
*/
@@ -142,7 +142,7 @@ public static function newByArray(string $name, array $define): static
142
142
* @param string $name
143
143
* @param string $desc
144
144
* @param string $type
145
- * @param bool $required
145
+ * @param bool $required
146
146
* @param mixed|null $default The default value
147
147
* - for Flag::ARG_OPTIONAL mode only
148
148
* - must be null for Flag::OPT_BOOLEAN
@@ -354,14 +354,15 @@ public function setDesc(string $desc): void
354
354
public function toArray (): array
355
355
{
356
356
return [
357
- 'name ' => $ this ->name ,
358
- 'desc ' => $ this ->desc ,
359
- 'type ' => $ this ->type ,
360
- 'default ' => $ this ->default ,
361
- 'envVar ' => $ this ->envVar ,
362
- 'required ' => $ this ->required ,
363
- 'isArray ' => $ this ->isArray (),
364
- 'helpType ' => $ this ->getHelpType (),
357
+ 'name ' => $ this ->name ,
358
+ 'desc ' => $ this ->desc ,
359
+ 'type ' => $ this ->type ,
360
+ 'default ' => $ this ->default ,
361
+ 'envVar ' => $ this ->envVar ,
362
+ 'required ' => $ this ->required ,
363
+ 'validator ' => $ this ->validator ,
364
+ 'isArray ' => $ this ->isArray (),
365
+ 'helpType ' => $ this ->getHelpType (),
365
366
];
366
367
}
367
368
@@ -431,6 +432,14 @@ public function setValidator(?callable $validator): void
431
432
}
432
433
}
433
434
435
+ /**
436
+ * @return callable|ValidatorInterface|null
437
+ */
438
+ public function getValidator (): callable |ValidatorInterface |null
439
+ {
440
+ return $ this ->validator ;
441
+ }
442
+
434
443
/**
435
444
* @return string
436
445
*/
0 commit comments