Skip to content

fix(multi): accept --projects as an array#79

Merged
miguelsanchez-upsun merged 2 commits into
mainfrom
fix/multi-projects-array
May 18, 2026
Merged

fix(multi): accept --projects as an array#79
miguelsanchez-upsun merged 2 commits into
mainfrom
fix/multi-projects-array

Conversation

@pjcdawkins
Copy link
Copy Markdown
Contributor

Summary

platform multi -p id1,id2 -- <cmd> failed with:

In ArrayArgument.php line 42:
  [BadMethodCallException]
  The value of option --projects is not an array

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 before any project lookup happened.

Add InputOption::VALUE_IS_ARRAY to the option definition, matching 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.

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings May 17, 2026 09:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_ARRAY to the --projects option in MultiCommand.
  • Add an integration test exercising both comma-separated and repeated -p invocations 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 miguelsanchez-upsun merged commit 09a8fcd into main May 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants