-
Notifications
You must be signed in to change notification settings - Fork 97
Closed
Labels
help wantedExtra attention is neededExtra attention is needed
Description
Symfony had a few recent PRs to the Symfony console that impacted my PHPStan analysis due to PHPDoc changes:
symfony/symfony#28448
symfony/symfony#28374
symfony/symfony#28647
Bottom line:
InputInterface::getArgumentnow returnsstring|string[]|nullInputInterface::getOptionreturnsstring|string[]|bool|null.
In reality, they can return string[] only if the relative argument/option is set as InputArgument::IS_ARRAY/InputOption::VALUE_IS_ARRAY.
Is it possible to add an aid in this package for this case? The minimum repro case is this one:
class PhpstanCommand extends \Symfony\Component\Console\Command\Command
{
protected function configure()
{
$this->addArgument('argument', InputArgument::REQUIRED);
$this->addOption('option', null, InputOption::VALUE_REQUIRED);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
// Cannot cast array<string>|string|null to string.
$argument = (string) $input->getArgument('argument');
// Cannot cast array<string>|bool|string|null to string.
$option = (string) $input->getOption('option');
}
}alexander-schranz, ossinkine, mabar, Kanti, gmenoiaa and 3 more
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed