Skip to content

Fix misleading statement to boolean Command Options #11943

@dsentker

Description

@dsentker

If an option is expected to be boolean (as shown in the documentation: --yell), seen here , the statement about InputOption::VALUE_OPTIONAL is misleading or wrong.

$input->getOption('yell') // always (!) returns NULL if no value is provided AND the third parameter from Command::addOption() is set to InputOption::VALUE_OPTIONAL

The documentation says about InputOption::VALUE_OPTIONAL :

"This option may or may not have a value (e.g., --yell or --yell=loud)"

Right here is the problem, because if the option has no value, it will always return NULL - no boolean operation is possible. I suggest a clarification about the correct operation to Boolean options.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions