-
Notifications
You must be signed in to change notification settings - Fork 96
Closed
Description
Symfony 4.0 documents Symfony\Component\Console\Command\Command::addOption()'s 5th parameter $default as mixed.
When using default values with InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL mode, the $default parameter expects array<int, string>|null.
This is wrong because keys are irrelevant and leads to error like this:
Parameter #5 $default of method Symfony\Component\Console\Command\Command::addOption() expects array<int, string>|null, array<string> given.
Happens when $default is given an array documented as string[].
Sample code:
/** @var string[] $default */
$default = getSomeDefaults();
$command->addOption(
'foo',
null,
InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL,
'foo bar',
$default
);This error pops up at level 0 only with this extension enabled, not without it.
Metadata
Metadata
Assignees
Labels
No labels