Skip to content

Conversation

@yceruto
Copy link
Member

@yceruto yceruto commented Oct 6, 2025

Q A
Branch? 7.4
Bug fix? no
New feature? no
Deprecations? no
Issues -
License MIT

Complements #61748, concerning interactive array and boolean arguments.

Definition:

public function __invoke(
    #[Argument, Ask('Must be unique?')]
    bool $unique,

    #[Argument, Ask('Enter the tag (leave blank to finish)')]
    array $tags,
): int

Input:

$ bin/console app:add-tags

Must be unique? (yes/no) [no]:
> yes

Enter the tag (leave blank to finish):
> tag1

Enter the tag (leave blank to finish):
> tag2

Enter the tag (leave blank to finish):
> 

As expected, you'll get a true value in $unique, and ["tag1", "tag2"] in $tags.

@yceruto yceruto changed the title [Console] Fixed array arguments support for interactive questions [Console] Fine-tuning the interactive #[Ask] attribute Oct 7, 2025
@yceruto
Copy link
Member Author

yceruto commented Oct 7, 2025

Update: I also added better support for bool arguments: using ConfirmationQuestion instead.

@yceruto
Copy link
Member Author

yceruto commented Oct 7, 2025

Other tests skip hidden questions on Windows, so I did the same to make these pass.

Failure: https://github.com/symfony/symfony/actions/runs/18308113247/job/52130086124?pr=61978#step:7:1384

@yceruto
Copy link
Member Author

yceruto commented Oct 8, 2025

rebased after #62004

@yceruto yceruto added the ❄️ Feature Freeze Important Pull Requests to finish before the next Symfony "feature freeze" label Oct 8, 2025
@nicolas-grekas
Copy link
Member

Thank you @yceruto.

@nicolas-grekas nicolas-grekas merged commit a0231af into symfony:7.4 Oct 8, 2025
11 of 12 checks passed
@yceruto yceruto deleted the console_interact branch October 8, 2025 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Console ❄️ Feature Freeze Important Pull Requests to finish before the next Symfony "feature freeze" Status: Reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants