-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[11.x] Fix prompting for missing array arguments on artisan command #50850
[11.x] Fix prompting for missing array arguments on artisan command #50850
Conversation
* fixed prompting for missing array arguments on artisan command
fixed:tests/Console/ConsoleApplicationTest.php
I'm leaving in draft until @jessarcher reviews it. |
I understand. |
Co-authored-by: Jess Archer <jess@jessarcher.com>
OK.That's right. |
Personally I think this needs more thought. If you provide the argument on the CLI, you would get the argument as an array using |
Good catch. I've updated it to wrap the response in an array. There isn't a good prompt for entering multiple arbitrary values, so with the default behaviour, you'd always get an array of one item. It's possible for someone to provide their own prompt callback that can return multiple values using whatever implementation they like ( |
Thanks! |
This PR fixes the bug below:
When an Artisan Command has array arguments configuration, like:
promptForMissingArgumentsUsing()
doesn't work,because
$input->getArgument($argument->getName())
returns empty array, and judgement inpromptForMissingArguments()
method ofIlluminate\Console\Concerns\PromptsForMissingInput
usesis_null()
, which should be replaced withempty()
.empty()
method also covers string argument, like: