New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Required params non-setted, not present #23
Comments
|
I think the correct behavior is already in place; let me explain why. Getopt is for options. They may or may not be present. So if an option is "missing", that's allowed, and not an error condition. The "required" descriptor on the option does not mean "this option is required to be present." It means "when present, this option must have a value." If there is something that must be passed, I suggest making it an argument, not an option. Hope that helps; please let me know if it does not. |
|
ok, but this precisions should be written, because it add some confusion. thanks for you answer. |
|
That's a fair point; I'll add to the docs. Thanks for pointing it out. |
|
@pmjones I have also faced this problem about required and was confused. Also using positional arguments means you need to make sure the argument order is same. Or is there another way to resolve this ? I feel to anyone the require is going to get confused. I have seen the commit , still in favour of having required in options to be required and pass exception. |
|
Perhaps we can add a new metthod that check "force required" args? |
Hello,
when we have required parameters that where not setted, the systems don't make any error. It should provide any error on hasError ...
Example :
when I try this with php cli.php -a test I have no error ....
tested on php 5.3
The text was updated successfully, but these errors were encountered: