The validator receives the data to validate. It must return the
validated data when the data is valid and throw an exception
otherwise.
public askAndValidate ( Symfony\Component\Console\Output\OutputInterface $output, string | array $question, callback $validator, integer $attempts = false, string $default = null ) : mixed | ||
$output | Symfony\Component\Console\Output\OutputInterface | |
$question | string | array | |
$validator | callback | A PHP callback |
$attempts | integer | Max number of times to ask before giving up (false by default, which means infinite) |
$default | string | The default answer if none is given by the user |
return | mixed |