-
Notifications
You must be signed in to change notification settings - Fork 95
Open
Description
Hello,
We have the following error messages while using a command argument/option default value as a constant:
------ ------------------------------------------------------------------------------------------------------------------------------
42 Parameter #4 $default of method Symfony\Component\Console\Command\Command::addArgument() expects string|null, mixed given.
42 Parameter #5 $default of method Symfony\Component\Console\Command\Command::addOption() expects int|string|null, mixed given.
------ ------------------------------------------------------------------------------------------------------------------------------
The following code should return the error:
public const MODE_CREATED = 'created';
protected function configure()
{
$this
->setName('abc')
->addArgument('a', InputArgument::REQUIRED, '', static::MODE_CREATED)
->addOption('b', null, InputOption::VALUE_REQUIRED, '', static::MODE_CREATED)
;
}
Even if the constant value is a string, it's understood as mixed.
For the moment, to avoid the error message, I have a private method which returns the constant value and use it as default value.
eliseumds
Metadata
Metadata
Assignees
Labels
No labels