Skip to content

Commit 949f8bf

Browse files
author
Robin Chalas
committed
Merge branch '3.4' into 4.1
* 3.4: [Console] Fix typo in tests [Console] Correct Command::initialize() and InputInterface::bind() phpdoc regarding thrown exceptions [Console] fixed corrupt error output for unknown multibyte short option [Console] fixed PHPDoc for setArgument/setOption in InputInterface [Intl] Blacklist Eurozone and United Nations in Region Data Generator
2 parents 541de26 + 1f22224 commit 949f8bf

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

Command/Command.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,14 @@ protected function interact(InputInterface $input, OutputInterface $output)
173173
}
174174

175175
/**
176-
* Initializes the command just after the input has been validated.
176+
* Initializes the command after the input has been bound and before the input
177+
* is validated.
177178
*
178179
* This is mainly useful when a lot of commands extends one main command
179180
* where some things need to be initialized based on the input arguments and options.
181+
*
182+
* @see InputInterface::bind()
183+
* @see InputInterface::validate()
180184
*/
181185
protected function initialize(InputInterface $input, OutputInterface $output)
182186
{

Input/ArgvInput.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ private function parseShortOptionSet($name)
121121
$len = \strlen($name);
122122
for ($i = 0; $i < $len; ++$i) {
123123
if (!$this->definition->hasShortcut($name[$i])) {
124-
throw new RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i]));
124+
$encoding = mb_detect_encoding($name, null, true);
125+
throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
125126
}
126127

127128
$option = $this->definition->getOptionForShortcut($name[$i]);

Input/InputInterface.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public function getParameterOption($values, $default = false, $onlyParams = fals
6161

6262
/**
6363
* Binds the current Input instance with the given arguments and options.
64+
*
65+
* @throws RuntimeException
6466
*/
6567
public function bind(InputDefinition $definition);
6668

@@ -92,8 +94,8 @@ public function getArgument($name);
9294
/**
9395
* Sets an argument value by name.
9496
*
95-
* @param string $name The argument name
96-
* @param string $value The argument value
97+
* @param string $name The argument name
98+
* @param string|string[] $value The argument value
9799
*
98100
* @throws InvalidArgumentException When argument given doesn't exist
99101
*/
@@ -129,8 +131,8 @@ public function getOption($name);
129131
/**
130132
* Sets an option value by name.
131133
*
132-
* @param string $name The option name
133-
* @param string|bool $value The option value
134+
* @param string $name The option name
135+
* @param string|string[]|bool $value The option value
134136
*
135137
* @throws InvalidArgumentException When option given doesn't exist
136138
*/

Tests/Helper/TableTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ public function testThrowsWhenTheCellInAnArray()
783783
$table->render();
784784
}
785785

786-
public function testColumnWith()
786+
public function testColumnWidth()
787787
{
788788
$table = new Table($output = $this->getOutputStream());
789789
$table
@@ -815,7 +815,7 @@ public function testColumnWith()
815815
$this->assertEquals($expected, $this->getOutputContent($output));
816816
}
817817

818-
public function testColumnWiths()
818+
public function testColumnWidths()
819819
{
820820
$table = new Table($output = $this->getOutputStream());
821821
$table

Tests/Input/ArgvInputTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,11 @@ public function provideInvalidInput()
246246
new InputDefinition(array(new InputArgument('number'))),
247247
'The "-1" option does not exist.',
248248
),
249+
array(
250+
array('cli.php', '-fЩ'),
251+
new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_NONE))),
252+
'The "-Щ" option does not exist.',
253+
),
249254
);
250255
}
251256

0 commit comments

Comments
 (0)