fix(multi): accept --projects as an array#79
Merged
Conversation
MultiCommand declared --projects with InputOption::VALUE_REQUIRED only, so Symfony returned the option value as a string. getSelectedProjects() then read it through ArrayArgument::getOption(), which insists on an array and threw BadMethodCallException: "The value of option --projects is not an array" before any project lookup happened. Add InputOption::VALUE_IS_ARRAY to the option definition, matching the pattern used by every other command that consumes its option through ArrayArgument::getOption (Environment\List, Resources, User\Add, etc.). ArrayArgument::split() still handles comma- and whitespace-separated values, so -p a,b,c, -p a -p b, and -p "a b" all work. Add an integration test that runs multi against two mocked projects using both comma-separated and repeated -p forms, and asserts the unknown-ID path produces the "Project ID(s) not found" error. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a bug in platform multi -p id1,id2 -- <cmd> which threw a BadMethodCallException because the --projects option was declared as a single string but read as an array via ArrayArgument::getOption. Adding VALUE_IS_ARRAY aligns the option with every other command that uses ArrayArgument, and the new integration test covers comma-separated, repeated -p, and unknown-ID flows.
Changes:
- Add
InputOption::VALUE_IS_ARRAYto the--projectsoption inMultiCommand. - Add an integration test exercising both comma-separated and repeated
-pinvocations plus the "Project ID(s) not found" error path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| legacy/src/Command/MultiCommand.php | Declares --projects as a VALUE_IS_ARRAY option so ArrayArgument::getOption no longer throws. |
| integration-tests/multi_test.go | New test covering successful multi runs with two project IDs (comma + repeated forms) and the unknown-ID error path. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
miguelsanchez-upsun
approved these changes
May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
platform multi -p id1,id2 -- <cmd>failed with:MultiCommanddeclared--projectswithInputOption::VALUE_REQUIREDonly, so Symfony returned the option value as a string.getSelectedProjects()then read it throughArrayArgument::getOption(), which insists on an array and threw before any project lookup happened.Add
InputOption::VALUE_IS_ARRAYto the option definition, matching every other command that consumes its option throughArrayArgument::getOption(Environment\List,Resources,User\Add, etc.).ArrayArgument::split()still handles comma- and whitespace-separated values, so-p a,b,c,-p a -p b, and-p "a b"all work.Add an integration test that runs
multiagainst two mocked projects using both comma-separated and repeated-pforms, and asserts the unknown-ID path produces the "Project ID(s) not found" error.🤖 Generated with Claude Code