From 621379b62bb19af213b569b60013200b11dd576f Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 15 Dec 2021 11:32:07 +0100 Subject: [PATCH 1/4] Try making tests a bit less transient --- Tests/ApplicationTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tests/ApplicationTest.php b/Tests/ApplicationTest.php index 1634c0199..6e9953dd2 100644 --- a/Tests/ApplicationTest.php +++ b/Tests/ApplicationTest.php @@ -894,6 +894,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(); @@ -917,6 +920,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(); From 37d3dec369b0d7f59d05f0856a529b60103ff0c2 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 16 Dec 2021 22:58:21 +0100 Subject: [PATCH 2/4] [5.4] cs fixes --- Helper/ProcessHelper.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Helper/ProcessHelper.php b/Helper/ProcessHelper.php index 87d3e6539..4ea3d724d 100644 --- a/Helper/ProcessHelper.php +++ b/Helper/ProcessHelper.php @@ -31,8 +31,6 @@ class ProcessHelper extends Helper * @param array|Process $cmd An instance of Process or an array of the command and arguments * @param callable|null $callback A PHP callback to run whenever there is some * output available on STDOUT or STDERR - * - * @return Process */ public function run(OutputInterface $output, $cmd, string $error = null, callable $callback = null, int $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE): Process { @@ -96,8 +94,6 @@ public function run(OutputInterface $output, $cmd, string $error = null, callabl * @param callable|null $callback A PHP callback to run whenever there is some * output available on STDOUT or STDERR * - * @return Process - * * @throws ProcessFailedException * * @see run() From d3e1852343a856bfb2a2189ef4f256f54640a2df Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 16 Dec 2021 23:13:01 +0100 Subject: [PATCH 3/4] [6.0] cs fixes --- Input/InputArgument.php | 2 -- Input/InputOption.php | 2 -- Question/Question.php | 2 -- Style/SymfonyStyle.php | 2 +- 4 files changed, 1 insertion(+), 7 deletions(-) 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]; From a2c6b7ced2eb7799a35375fb9022519282b5405e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Mon, 20 Dec 2021 16:57:13 +0100 Subject: [PATCH 4/4] =?UTF-8?q?[Console]=C2=A0Fix=20autocompletion=20of=20?= =?UTF-8?q?argument=20with=20default=20value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Completion/CompletionInput.php | 8 ++++---- Tests/Command/HelpCommandTest.php | 2 +- Tests/Completion/CompletionInputTest.php | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) 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/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