>> */ public static function argvWithInvalidInputProvider(): array { return [ 'simple-option' => [['myapp', '--invalid-option', 'myvalue']], 'value-option' => [['myapp', '--invalid-option=foo', 'myvalue']], 'short-option' => [['myapp', '-i', 'myvalue']], // explicitly not supported for now; we can't tell which is the argument here // 'split-option' => [['myapp', '--invalid-option', 'foo', 'myvalue']], ]; } /** @param list $argv */ #[DataProvider('argvWithInvalidInputProvider')] public function testInvalidOptionsDoNotCauseArgumentsToBeMissed(array $argv): void { $definition = new InputDefinition(); $definition->addArgument(new InputArgument('myarg', InputArgument::OPTIONAL)); $argvInput = new ArgvInput($argv); try { $argvInput->bind($definition); self::fail('Expected an exception to be thrown because `--invalid-option` is not defined'); } catch (Throwable) { // An exception is expected here, because `--invalid-option` was not defined self::addToAssertionCount(1); } // But, crucially, we should have captured the following argument self::assertSame('myvalue', $argvInput->getArgument('myarg')); } }