From 3c65c2dda22b7794dde8dd5e0c2f7b5542ae0d2c Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Tue, 9 Mar 2021 17:59:23 +0100 Subject: [PATCH 1/7] bug #40427 [Console] Stop accepting ints as InputOption defaults The types accepted and provided by `InputInterface::getOption` and `setOption` do not include `int` (and passing something like `--option=123` will set the option to the string `"123"`, not to the integer `123`). The `InputOption` default types should match this. --- Command/Command.php | 10 +++++----- Input/InputOption.php | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Command/Command.php b/Command/Command.php index 71ad4a49e..d4ab2eb8d 100644 --- a/Command/Command.php +++ b/Command/Command.php @@ -394,11 +394,11 @@ public function addArgument($name, $mode = null, $description = '', $default = n /** * Adds an option. * - * @param string $name The option name - * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts - * @param int|null $mode The option mode: One of the InputOption::VALUE_* constants - * @param string $description A description text - * @param string|string[]|int|bool|null $default The default value (must be null for InputOption::VALUE_NONE) + * @param string $name The option name + * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts + * @param int|null $mode The option mode: One of the InputOption::VALUE_* constants + * @param string $description A description text + * @param string|string[]|bool|null $default The default value (must be null for InputOption::VALUE_NONE) * * @throws InvalidArgumentException If option mode is invalid or incompatible * diff --git a/Input/InputOption.php b/Input/InputOption.php index 66f857a6c..a8e956db5 100644 --- a/Input/InputOption.php +++ b/Input/InputOption.php @@ -33,11 +33,11 @@ class InputOption private $description; /** - * @param string $name The option name - * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts - * @param int|null $mode The option mode: One of the VALUE_* constants - * @param string $description A description text - * @param string|string[]|int|bool|null $default The default value (must be null for self::VALUE_NONE) + * @param string $name The option name + * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts + * @param int|null $mode The option mode: One of the VALUE_* constants + * @param string $description A description text + * @param string|string[]|bool|null $default The default value (must be null for self::VALUE_NONE) * * @throws InvalidArgumentException If option mode is invalid or incompatible */ @@ -149,7 +149,7 @@ public function isArray() /** * Sets the default value. * - * @param string|string[]|int|bool|null $default The default value + * @param string|string[]|bool|null $default The default value * * @throws LogicException When incorrect default value is given */ @@ -173,7 +173,7 @@ public function setDefault($default = null) /** * Returns the default value. * - * @return string|string[]|int|bool|null The default value + * @return string|string[]|bool|null The default value */ public function getDefault() { From eaa700fb4f4715c9ddbf80555f1f4de274f0cddd Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Thu, 11 Mar 2021 12:15:07 -0800 Subject: [PATCH 2/7] [Console] ProgressBar clears too many lines on update --- Helper/ProgressBar.php | 2 +- Tests/Helper/ProgressBarTest.php | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Helper/ProgressBar.php b/Helper/ProgressBar.php index 4690cffbd..824c0f296 100644 --- a/Helper/ProgressBar.php +++ b/Helper/ProgressBar.php @@ -441,7 +441,7 @@ private function overwrite(string $message): void if ($this->overwrite) { if (null !== $this->previousMessage) { if ($this->output instanceof ConsoleSectionOutput) { - $lines = floor(Helper::strlen($message) / $this->terminal->getWidth()) + $this->formatLineCount + 1; + $lines = floor(Helper::strlenWithoutDecoration($this->output->getFormatter(), $message) / $this->terminal->getWidth()) + $this->formatLineCount + 1; $this->output->clear($lines); } else { // Erase previous lines diff --git a/Tests/Helper/ProgressBarTest.php b/Tests/Helper/ProgressBarTest.php index d927f4dfc..aabadef2c 100644 --- a/Tests/Helper/ProgressBarTest.php +++ b/Tests/Helper/ProgressBarTest.php @@ -343,6 +343,31 @@ public function testOverwriteWithSectionOutput() ); } + public function testOverwriteWithAnsiSectionOutput() + { + // output has 43 visible characters plus 2 invisible ANSI characters + putenv('COLUMNS=43'); + $sections = []; + $stream = $this->getOutputStream(true); + $output = new ConsoleSectionOutput($stream->getStream(), $sections, $stream->getVerbosity(), $stream->isDecorated(), new OutputFormatter()); + + $bar = new ProgressBar($output, 50, 0); + $bar->setFormat(" \033[44;37m%current%/%max%\033[0m [%bar%] %percent:3s%%"); + $bar->start(); + $bar->display(); + $bar->advance(); + $bar->advance(); + + rewind($output->getStream()); + $this->assertSame( + " \033[44;37m 0/50\033[0m [>---------------------------] 0%".\PHP_EOL. + "\x1b[1A\x1b[0J"." \033[44;37m 1/50\033[0m [>---------------------------] 2%".\PHP_EOL. + "\x1b[1A\x1b[0J"." \033[44;37m 2/50\033[0m [=>--------------------------] 4%".\PHP_EOL, + stream_get_contents($output->getStream()) + ); + putenv('COLUMNS=120'); + } + public function testOverwriteMultipleProgressBarsWithSectionOutputs() { $sections = []; From ef7b1af62c511a944d9af6cc98f21a1bd673ccac Mon Sep 17 00:00:00 2001 From: Matthew Grasmick Date: Tue, 16 Mar 2021 22:19:58 -0400 Subject: [PATCH 3/7] Correctly clear lines for multi-line progress bar messages. --- Helper/ProgressBar.php | 11 +++++++++-- Tests/Helper/ProgressBarTest.php | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/Helper/ProgressBar.php b/Helper/ProgressBar.php index 824c0f296..5049c7dae 100644 --- a/Helper/ProgressBar.php +++ b/Helper/ProgressBar.php @@ -441,8 +441,15 @@ private function overwrite(string $message): void if ($this->overwrite) { if (null !== $this->previousMessage) { if ($this->output instanceof ConsoleSectionOutput) { - $lines = floor(Helper::strlenWithoutDecoration($this->output->getFormatter(), $message) / $this->terminal->getWidth()) + $this->formatLineCount + 1; - $this->output->clear($lines); + $messageLines = explode("\n", $message); + $lineCount = \count($messageLines); + foreach ($messageLines as $messageLine) { + $messageLineLength = Helper::strlenWithoutDecoration($this->output->getFormatter(), $messageLine); + if ($messageLineLength > $this->terminal->getWidth()) { + $lineCount += floor($messageLineLength / $this->terminal->getWidth()); + } + } + $this->output->clear($lineCount); } else { // Erase previous lines if ($this->formatLineCount > 0) { diff --git a/Tests/Helper/ProgressBarTest.php b/Tests/Helper/ProgressBarTest.php index aabadef2c..2d32e1c3d 100644 --- a/Tests/Helper/ProgressBarTest.php +++ b/Tests/Helper/ProgressBarTest.php @@ -397,6 +397,34 @@ public function testOverwriteMultipleProgressBarsWithSectionOutputs() ); } + public function testOverwriteWithSectionOutputWithNewlinesInMessage() + { + $sections = []; + $stream = $this->getOutputStream(true); + $output = new ConsoleSectionOutput($stream->getStream(), $sections, $stream->getVerbosity(), $stream->isDecorated(), new OutputFormatter()); + + ProgressBar::setFormatDefinition('test', '%current%/%max% [%bar%] %percent:3s%% %message% Fruitcake marzipan toffee. Cupcake gummi bears tart dessert ice cream chupa chups cupcake chocolate bar sesame snaps. Croissant halvah cookie jujubes powder macaroon. Fruitcake bear claw bonbon jelly beans oat cake pie muffin Fruitcake marzipan toffee.'); + + $bar = new ProgressBar($output, 50, 0); + $bar->setFormat('test'); + $bar->start(); + $bar->display(); + $bar->setMessage("Twas brillig, and the slithy toves. Did gyre and gimble in the wabe: All mimsy were the borogoves, And the mome raths outgrabe.\nBeware the Jabberwock, my son! The jaws that bite, the claws that catch! Beware the Jubjub bird, and shun The frumious Bandersnatch!"); + $bar->advance(); + $bar->setMessage("He took his vorpal sword in hand; Long time the manxome foe he soughtβ€” So rested he by the Tumtum tree And stood awhile in thought.\nAnd, as in uffish thought he stood, The Jabberwock, with eyes of flame, Came whiffling through the tulgey wood, And burbled as it came!"); + $bar->advance(); + + rewind($output->getStream()); + $this->assertEquals( + ' 0/50 [>] 0% %message% Fruitcake marzipan toffee. Cupcake gummi bears tart dessert ice cream chupa chups cupcake chocolate bar sesame snaps. Croissant halvah cookie jujubes powder macaroon. Fruitcake bear claw bonbon jelly beans oat cake pie muffin Fruitcake marzipan toffee.'.\PHP_EOL. + "\x1b[6A\x1b[0J 1/50 [>] 2% Twas brillig, and the slithy toves. Did gyre and gimble in the wabe: All mimsy were the borogoves, And the mome raths outgrabe. +Beware the Jabberwock, my son! The jaws that bite, the claws that catch! Beware the Jubjub bird, and shun The frumious Bandersnatch! Fruitcake marzipan toffee. Cupcake gummi bears tart dessert ice cream chupa chups cupcake chocolate bar sesame snaps. Croissant halvah cookie jujubes powder macaroon. Fruitcake bear claw bonbon jelly beans oat cake pie muffin Fruitcake marzipan toffee.".\PHP_EOL. + "\x1b[6A\x1b[0J 2/50 [>] 4% He took his vorpal sword in hand; Long time the manxome foe he soughtβ€” So rested he by the Tumtum tree And stood awhile in thought. +And, as in uffish thought he stood, The Jabberwock, with eyes of flame, Came whiffling through the tulgey wood, And burbled as it came! Fruitcake marzipan toffee. Cupcake gummi bears tart dessert ice cream chupa chups cupcake chocolate bar sesame snaps. Croissant halvah cookie jujubes powder macaroon. Fruitcake bear claw bonbon jelly beans oat cake pie muffin Fruitcake marzipan toffee.".\PHP_EOL, + stream_get_contents($output->getStream()) + ); + } + public function testMultipleSectionsWithCustomFormat() { $sections = []; From 1a5fe7116954c3758bc6d2678af504c2c5134c64 Mon Sep 17 00:00:00 2001 From: Matthew Grasmick Date: Tue, 2 Mar 2021 16:31:24 -0500 Subject: [PATCH 4/7] [Console] Fix line wrapping for decorated text in block output --- Style/SymfonyStyle.php | 11 +++++++++-- .../Fixtures/Style/SymfonyStyle/output/output_13.txt | 10 +++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Style/SymfonyStyle.php b/Style/SymfonyStyle.php index 2056f04c9..ba89fb422 100644 --- a/Style/SymfonyStyle.php +++ b/Style/SymfonyStyle.php @@ -471,7 +471,12 @@ private function createBlock(iterable $messages, string $type = null, string $st $message = OutputFormatter::escape($message); } - $lines = array_merge($lines, explode(\PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, \PHP_EOL, true))); + $decorationLength = Helper::strlen($message) - Helper::strlenWithoutDecoration($this->getFormatter(), $message); + $messageLineLength = min($this->lineLength - $prefixLength - $indentLength + $decorationLength, $this->lineLength); + $messageLines = explode(\PHP_EOL, wordwrap($message, $messageLineLength, \PHP_EOL, true)); + foreach ($messageLines as $messageLine) { + $lines[] = $messageLine; + } if (\count($messages) > 1 && $key < \count($messages) - 1) { $lines[] = ''; @@ -491,7 +496,9 @@ private function createBlock(iterable $messages, string $type = null, string $st } $line = $prefix.$line; - $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line)); + $decorationLength = Helper::strlen($line) - Helper::strlenWithoutDecoration($this->getFormatter(), $line); + $messageLineLength = min($this->lineLength - $prefixLength - $indentLength + $decorationLength, $this->lineLength); + $line .= str_repeat(' ', max($this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line), 0)); if ($style) { $line = sprintf('<%s>%s', $style, $line); diff --git a/Tests/Fixtures/Style/SymfonyStyle/output/output_13.txt b/Tests/Fixtures/Style/SymfonyStyle/output/output_13.txt index 0f3704b74..ea8e4351e 100644 --- a/Tests/Fixtures/Style/SymfonyStyle/output/output_13.txt +++ b/Tests/Fixtures/Style/SymfonyStyle/output/output_13.txt @@ -1,7 +1,7 @@ - // Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et  - // dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea  - // commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla  - // pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim - // id est laborum + // Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore  + // magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo  + // consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla  + // pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id + // est laborum From 054f54870e4322d4553bbf602962502a3d4ea2cb Mon Sep 17 00:00:00 2001 From: Marion Hurteau Date: Fri, 19 Mar 2021 20:16:44 +0100 Subject: [PATCH 5/7] [Command] fix emojis messing up the line width add tests + removed irrelevant method --- Helper/Helper.php | 25 +++++++++++++------ Helper/QuestionHelper.php | 2 +- Style/SymfonyStyle.php | 2 -- .../Style/SymfonyStyle/command/command_21.php | 13 ++++++++++ .../Style/SymfonyStyle/output/output_21.txt | 7 ++++++ 5 files changed, 39 insertions(+), 10 deletions(-) create mode 100644 Tests/Fixtures/Style/SymfonyStyle/command/command_21.php create mode 100644 Tests/Fixtures/Style/SymfonyStyle/output/output_21.txt diff --git a/Helper/Helper.php b/Helper/Helper.php index f82dd286f..acec994db 100644 --- a/Helper/Helper.php +++ b/Helper/Helper.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Console\Helper; use Symfony\Component\Console\Formatter\OutputFormatterInterface; +use Symfony\Component\String\UnicodeString; /** * Helper is the base class for all helper classes. @@ -45,7 +46,11 @@ public function getHelperSet() */ public static function strlen(?string $string) { - $string = (string) $string; + $string ?? $string = ''; + + if (preg_match('//u', $string)) { + return (new UnicodeString($string))->width(false); + } if (false === $encoding = mb_detect_encoding($string, null, true)) { return \strlen($string); @@ -59,9 +64,9 @@ public static function strlen(?string $string) * * @return string The string subset */ - public static function substr(string $string, int $from, int $length = null) + public static function substr(?string $string, int $from, int $length = null) { - $string = (string) $string; + $string ?? $string = ''; if (false === $encoding = mb_detect_encoding($string, null, true)) { return substr($string, $from, $length); @@ -116,17 +121,23 @@ public static function formatMemory(int $memory) return sprintf('%d B', $memory); } - public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string) + public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, ?string $string) { - return self::strlen(self::removeDecoration($formatter, $string)); + $string = self::removeDecoration($formatter, $string); + + if (preg_match('//u', $string)) { + return (new UnicodeString($string))->width(true); + } + + return self::strlen($string); } - public static function removeDecoration(OutputFormatterInterface $formatter, $string) + public static function removeDecoration(OutputFormatterInterface $formatter, ?string $string) { $isDecorated = $formatter->isDecorated(); $formatter->setDecorated(false); // remove <...> formatting - $string = $formatter->format($string); + $string = $formatter->format($string ?? ''); // remove already formatted characters $string = preg_replace("/\033\[[^m]*m/", '', $string); $formatter->setDecorated($isDecorated); diff --git a/Helper/QuestionHelper.php b/Helper/QuestionHelper.php index c0fb5461f..5bf8186b8 100644 --- a/Helper/QuestionHelper.php +++ b/Helper/QuestionHelper.php @@ -311,7 +311,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu $remainingCharacters = substr($ret, \strlen(trim($this->mostRecentlyEnteredValue($fullChoice)))); $output->write($remainingCharacters); $fullChoice .= $remainingCharacters; - $i = self::strlen($fullChoice); + $i = (false === $encoding = mb_detect_encoding($fullChoice, null, true)) ? \strlen($fullChoice) : mb_strlen($fullChoice, $encoding); $matches = array_filter( $autocomplete($ret), diff --git a/Style/SymfonyStyle.php b/Style/SymfonyStyle.php index 187bceed2..075fe6621 100644 --- a/Style/SymfonyStyle.php +++ b/Style/SymfonyStyle.php @@ -501,8 +501,6 @@ private function createBlock(iterable $messages, string $type = null, string $st } $line = $prefix.$line; - $decorationLength = Helper::strlen($line) - Helper::strlenWithoutDecoration($this->getFormatter(), $line); - $messageLineLength = min($this->lineLength - $prefixLength - $indentLength + $decorationLength, $this->lineLength); $line .= str_repeat(' ', max($this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line), 0)); if ($style) { diff --git a/Tests/Fixtures/Style/SymfonyStyle/command/command_21.php b/Tests/Fixtures/Style/SymfonyStyle/command/command_21.php new file mode 100644 index 000000000..8460e7ece --- /dev/null +++ b/Tests/Fixtures/Style/SymfonyStyle/command/command_21.php @@ -0,0 +1,13 @@ +success('Lorem ipsum dolor sit amet'); + $output->success('Lorem ipsum dolor sit amet with one emoji πŸŽ‰'); + $output->success('Lorem ipsum dolor sit amet with so many of them πŸ‘©β€πŸŒΎπŸ‘©β€πŸŒΎπŸ‘©β€πŸŒΎπŸ‘©β€πŸŒΎπŸ‘©β€πŸŒΎ'); +}; diff --git a/Tests/Fixtures/Style/SymfonyStyle/output/output_21.txt b/Tests/Fixtures/Style/SymfonyStyle/output/output_21.txt new file mode 100644 index 000000000..aee3c4a89 --- /dev/null +++ b/Tests/Fixtures/Style/SymfonyStyle/output/output_21.txt @@ -0,0 +1,7 @@ + + [OK] Lorem ipsum dolor sit amet + + [OK] Lorem ipsum dolor sit amet with one emoji πŸŽ‰ + + [OK] Lorem ipsum dolor sit amet with so many of them πŸ‘©β€πŸŒΎπŸ‘©β€πŸŒΎπŸ‘©β€πŸŒΎπŸ‘©β€πŸŒΎπŸ‘©β€πŸŒΎ + From 075ea6490f7b26831b51839176d6284ea5c839cc Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 23 Mar 2021 13:24:21 +0100 Subject: [PATCH 6/7] [Console] minor fix --- Helper/QuestionHelper.php | 2 +- Style/SymfonyStyle.php | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Helper/QuestionHelper.php b/Helper/QuestionHelper.php index d211fcfd1..6dde580cf 100644 --- a/Helper/QuestionHelper.php +++ b/Helper/QuestionHelper.php @@ -309,7 +309,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu $remainingCharacters = substr($ret, \strlen(trim($this->mostRecentlyEnteredValue($fullChoice)))); $output->write($remainingCharacters); $fullChoice .= $remainingCharacters; - $i = self::strlen($fullChoice); + $i = (false === $encoding = mb_detect_encoding($fullChoice, null, true)) ? \strlen($fullChoice) : mb_strlen($fullChoice, $encoding); $matches = array_filter( $autocomplete($ret), diff --git a/Style/SymfonyStyle.php b/Style/SymfonyStyle.php index ba89fb422..ecdf9b1a3 100644 --- a/Style/SymfonyStyle.php +++ b/Style/SymfonyStyle.php @@ -496,8 +496,6 @@ private function createBlock(iterable $messages, string $type = null, string $st } $line = $prefix.$line; - $decorationLength = Helper::strlen($line) - Helper::strlenWithoutDecoration($this->getFormatter(), $line); - $messageLineLength = min($this->lineLength - $prefixLength - $indentLength + $decorationLength, $this->lineLength); $line .= str_repeat(' ', max($this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line), 0)); if ($style) { From 1ba4560dbbb9fcf5ae28b61f71f49c678086cf23 Mon Sep 17 00:00:00 2001 From: Roberto Nygaard Date: Thu, 25 Mar 2021 22:22:40 +0000 Subject: [PATCH 7/7] Uses the correct assignment action for console options depending if they are short or long --- Input/ArrayInput.php | 5 +++-- Tests/Input/ArrayInputTest.php | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Input/ArrayInput.php b/Input/ArrayInput.php index 25d2b750b..bf9a8a455 100644 --- a/Input/ArrayInput.php +++ b/Input/ArrayInput.php @@ -108,12 +108,13 @@ public function __toString() $params = []; foreach ($this->parameters as $param => $val) { if ($param && \is_string($param) && '-' === $param[0]) { + $glue = ('-' === $param[1]) ? '=' : ' '; if (\is_array($val)) { foreach ($val as $v) { - $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : ''); + $params[] = $param.('' != $v ? $glue.$this->escapeToken($v) : ''); } } else { - $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : ''); + $params[] = $param.('' != $val ? $glue.$this->escapeToken($val) : ''); } } else { $params[] = \is_array($val) ? implode(' ', array_map([$this, 'escapeToken'], $val)) : $this->escapeToken($val); diff --git a/Tests/Input/ArrayInputTest.php b/Tests/Input/ArrayInputTest.php index f3eedb3a2..5777c44b7 100644 --- a/Tests/Input/ArrayInputTest.php +++ b/Tests/Input/ArrayInputTest.php @@ -162,10 +162,10 @@ public function provideInvalidInput() public function testToString() { $input = new ArrayInput(['-f' => null, '-b' => 'bar', '--foo' => 'b a z', '--lala' => null, 'test' => 'Foo', 'test2' => "A\nB'C"]); - $this->assertEquals('-f -b=bar --foo='.escapeshellarg('b a z').' --lala Foo '.escapeshellarg("A\nB'C"), (string) $input); + $this->assertEquals('-f -b bar --foo='.escapeshellarg('b a z').' --lala Foo '.escapeshellarg("A\nB'C"), (string) $input); $input = new ArrayInput(['-b' => ['bval_1', 'bval_2'], '--f' => ['fval_1', 'fval_2']]); - $this->assertSame('-b=bval_1 -b=bval_2 --f=fval_1 --f=fval_2', (string) $input); + $this->assertSame('-b bval_1 -b bval_2 --f=fval_1 --f=fval_2', (string) $input); $input = new ArrayInput(['array_arg' => ['val_1', 'val_2']]); $this->assertSame('val_1 val_2', (string) $input);