Closed
Description
This is a question, I'd be interested in implementing this, but not sure if its possible with Phpstan, so a point in the right direction would be useful.
In Symfony commands options (and arguments) are added in configure
function, and this affects the return type of $input->getOption
later.
class MyCommand {
protected function configure(): void
{
$this
->addOption('str', null, InputOption::VALUE_REQUIRED, 'This option will be ?string')
->addOption('bool', null, InputOption::VALUE_NONE, 'this option will be bool')
->addOption('arra', null, InputOption::VALUE_IS_ARRAY, 'this option will be ?(string[])')
;
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$str = $input->getOption('str');
}
}
So can I change the return type of getOption
, according to the options that are configured?
Metadata
Metadata
Assignees
Labels
No labels