diff --git a/Completion/CompletionInput.php b/Completion/CompletionInput.php index eda95bef5..368b94507 100644 --- a/Completion/CompletionInput.php +++ b/Completion/CompletionInput.php @@ -109,12 +109,12 @@ public function bind(InputDefinition $definition): void // complete argument value $this->completionType = self::TYPE_ARGUMENT_VALUE; - $arguments = $this->getArguments(); - foreach ($arguments as $argumentName => $argumentValue) { - if (null === $argumentValue) { + foreach ($this->definition->getArguments() as $argumentName => $argument) { + if (!isset($this->arguments[$argumentName])) { break; } + $argumentValue = $this->arguments[$argumentName]; $this->completionName = $argumentName; if (\is_array($argumentValue)) { $this->completionValue = $argumentValue ? $argumentValue[array_key_last($argumentValue)] : null; @@ -124,7 +124,7 @@ public function bind(InputDefinition $definition): void } if ($this->currentIndex >= \count($this->tokens)) { - if (null === $arguments[$argumentName] || $this->definition->getArgument($argumentName)->isArray()) { + if (!isset($this->arguments[$argumentName]) || $this->definition->getArgument($argumentName)->isArray()) { $this->completionName = $argumentName; $this->completionValue = ''; } else { diff --git a/Input/InputArgument.php b/Input/InputArgument.php index f89fa33c9..143e4b10a 100644 --- a/Input/InputArgument.php +++ b/Input/InputArgument.php @@ -105,8 +105,6 @@ public function setDefault(string|bool|int|float|array $default = null) /** * Returns the default value. - * - * @return string|bool|int|float|array|null */ public function getDefault(): string|bool|int|float|array|null { diff --git a/Input/InputOption.php b/Input/InputOption.php index 613af2035..f9d74a896 100644 --- a/Input/InputOption.php +++ b/Input/InputOption.php @@ -187,8 +187,6 @@ public function setDefault(string|bool|int|float|array $default = null) /** * Returns the default value. - * - * @return string|bool|int|float|array|null */ public function getDefault(): string|bool|int|float|array|null { diff --git a/Question/Question.php b/Question/Question.php index 7d5e3accb..f99e685de 100644 --- a/Question/Question.php +++ b/Question/Question.php @@ -52,8 +52,6 @@ public function getQuestion(): string /** * Returns the default answer. - * - * @return string|bool|int|float|null */ public function getDefault(): string|bool|int|float|null { diff --git a/Style/SymfonyStyle.php b/Style/SymfonyStyle.php index 78af16670..56ad30a6f 100644 --- a/Style/SymfonyStyle.php +++ b/Style/SymfonyStyle.php @@ -59,7 +59,7 @@ public function __construct(InputInterface $input, OutputInterface $output) /** * Formats a message as a block of text. */ - public function block(string|array $messages, ?string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true) + public function block(string|array $messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = true) { $messages = \is_array($messages) ? array_values($messages) : [$messages]; diff --git a/Tests/ApplicationTest.php b/Tests/ApplicationTest.php index a4fe5b8e4..619009efe 100644 --- a/Tests/ApplicationTest.php +++ b/Tests/ApplicationTest.php @@ -883,6 +883,9 @@ public function testRenderExceptionLineBreaks() $this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_renderexception_linebreaks.txt', $tester->getDisplay(true), '->renderException() keep multiple line breaks'); } + /** + * @group transient-on-windows + */ public function testRenderAnonymousException() { $application = new Application(); @@ -906,6 +909,9 @@ public function testRenderAnonymousException() $this->assertStringContainsString('Dummy type "class@anonymous" is invalid.', $tester->getDisplay(true)); } + /** + * @group transient-on-windows + */ public function testRenderExceptionStackTraceContainsRootException() { $application = new Application(); diff --git a/Tests/Command/HelpCommandTest.php b/Tests/Command/HelpCommandTest.php index bf0ab9720..0e8a7f4f7 100644 --- a/Tests/Command/HelpCommandTest.php +++ b/Tests/Command/HelpCommandTest.php @@ -92,7 +92,7 @@ public function provideCompletionSuggestions() yield 'nothing' => [ [''], - [], + ['completion', 'help', 'list', 'foo:bar'], ]; yield 'command_name' => [ diff --git a/Tests/Completion/CompletionInputTest.php b/Tests/Completion/CompletionInputTest.php index f83a0f898..ee370076c 100644 --- a/Tests/Completion/CompletionInputTest.php +++ b/Tests/Completion/CompletionInputTest.php @@ -97,6 +97,20 @@ public function provideBindWithLastArrayArgumentData() yield [CompletionInput::fromTokens(['bin/console', 'symfony', 'sen'], 2), 'sen']; } + public function testBindArgumentWithDefault() + { + $definition = new InputDefinition([ + new InputArgument('arg-with-default', InputArgument::OPTIONAL, '', 'default'), + ]); + + $input = CompletionInput::fromTokens(['bin/console'], 1); + $input->bind($definition); + + $this->assertEquals(CompletionInput::TYPE_ARGUMENT_VALUE, $input->getCompletionType(), 'Unexpected type'); + $this->assertEquals('arg-with-default', $input->getCompletionName(), 'Unexpected name'); + $this->assertEquals('', $input->getCompletionValue(), 'Unexpected value'); + } + /** * @dataProvider provideFromStringData */ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy