$cmd = new \Commando\Command();
// Define an option
$cmd->option("t");
// If that option is a certain value, then define another option (this causes autoparsing)
if ($cmd['t'] == 'something') {
// do something, like perhaps define other options
}
// Now define a required option. Because we've already parsed the options, the rules
// for this option won't cause an error when really they should.
$cmd->option("e")
->required()
->must(function($t) {
return preg_match("/^[^0-9]+$/", $t);
});
// Try to echo the required 'e' option. Script should not get to this point, but does,
// and also doesn't throw an error here.
echo $cmd['e'];
Does not show any errors at all, and outputs any value given for option 'e'.
Given this script:
Expected Behavior
requiredcalled on option 'e'.mustcalled on option 'e'.Actual Behavior
Does not show any errors at all, and outputs any value given for option 'e'.