-
Notifications
You must be signed in to change notification settings - Fork 93
Add support for negatable input options #300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for negatable input options #300
Conversation
Since symfony/console 5.3, input options can be marked as negatable. The appropriate return type when calling `$input->getOption()` can be either a boolean or null. With this change, support for return types of such negatable input options is added.
Perfect, thank you! |
Hi @eliashaeussler, @ondrejmirtes, after merging/releasing 1.2.11 we experience problems with the older Symfony projects. I have no idea how to debug this further at this point. Can I contribute to this bug report? Would you rather have a separate issue? Please let me know. composer info symfony/symfony | grep 'versions'
composer info phpstan/phpstan-symfony | grep 'versions'
php -v
Symfony command <?php
namespace CoreDomainBundle\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
final class PhpStanErrorCommand extends Command
{
protected function configure(): void
{
$this->setName('phpstan:error');
$this->addOption('test-option');
}
protected function execute(
InputInterface $input,
OutputInterface $output
): ?int {
$input->getOption('test-option');
return 0;
}
} PHPStan config parameters:
tmpDir: var/ci/phpstan/
level: 8
paths:
- src/CoreDomainBundle/Command/PhpStanErrorCommand.php
symfony:
consoleApplicationLoader: .phpstan/console-application.php php ./vendor/bin/phpstan analyse --no-progress --memory-limit=-1 -v
|
Hi @cafferata, thanks for your report and sorry, that I've missed that aspect. I pushed a fix, see #305. |
@cafferata @eliashaeussler Thanks. We no longer test older Symfony versions, it should be your priority to upgrade to a supported version (5.3+). But I accepted a quickfix for this problem. |
Hi @eliashaeussler, thanks for the quick fix! 👏
This project is in the middle of a upgrade to a supported version. But in the meantime all the Composer packages are updated weekly. |
Since symfony/console 5.3 (symfony/symfony#39642), input options can be marked as "negatable". The appropriate return type when calling
$input->getOption()
can be either a boolean ornull
. With this change, support for return types of such negatable input options is added.