Skip to content

Conversation

@yceruto
Copy link
Member

@yceruto yceruto commented Dec 19, 2025

Fixes #21650

I kept both approaches for now so that later we can extract the classic approach into a new section as part of #21168.

{
public function __invoke(
#[Option(shortcut: 'f')] bool $foo = false,
#[Option(shortcut: 'b')] string $bar = '',
Copy link
Contributor

Choose a reason for hiding this comment

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

The value of the bar option (and its b shortcut respectively) is required.

So default to empty string must be removed ? (en reorder args)

This sentence if not true with options attributes write ?

Copy link
Member Author

Choose a reason for hiding this comment

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

it's true, and it refers to the moment when the option is used; at that point, we're forced to set a value for that option.

in other words, having a default value (which is required for options) means it's the value used when the option is not passed on the command line. When the option is passed, it must include a value, e.i. --opt=1, passing just --opt is forbidden under this definition

@yceruto yceruto force-pushed the console_input_attributes branch from 9a523f3 to 0a2c166 Compare January 5, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants