diff --git a/Descriptor/ApplicationDescription.php b/Descriptor/ApplicationDescription.php index af8836391..d361b4890 100644 --- a/Descriptor/ApplicationDescription.php +++ b/Descriptor/ApplicationDescription.php @@ -77,7 +77,7 @@ public function getCommands(): array public function getCommand(string $name): Command { if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) { - throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name)); + throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name)); } return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name]; diff --git a/Formatter/OutputFormatter.php b/Formatter/OutputFormatter.php index ad8a797fe..8fc9f286e 100644 --- a/Formatter/OutputFormatter.php +++ b/Formatter/OutputFormatter.php @@ -113,7 +113,7 @@ public function hasStyle(string $name) public function getStyle(string $name) { if (!$this->hasStyle($name)) { - throw new InvalidArgumentException(sprintf('Undefined style: %s.', $name)); + throw new InvalidArgumentException(sprintf('Undefined style: "%s".', $name)); } return $this->styles[strtolower($name)]; diff --git a/Helper/Table.php b/Helper/Table.php index 5aefa3d7b..8fc1d7429 100644 --- a/Helper/Table.php +++ b/Helper/Table.php @@ -606,7 +606,7 @@ private function fillNextRows(array $rows, int $line): array $unmergedRows = []; foreach ($rows[$line] as $column => $cell) { if (null !== $cell && !$cell instanceof TableCell && !is_scalar($cell) && !(\is_object($cell) && method_exists($cell, '__toString'))) { - throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing __toString, %s given.', \gettype($cell))); + throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing "__toString()", "%s" given.', \gettype($cell))); } if ($cell instanceof TableCell && $cell->getRowspan() > 1) { $nbLines = $cell->getRowspan() - 1; diff --git a/Question/ChoiceQuestion.php b/Question/ChoiceQuestion.php index 020b733f1..24e660494 100644 --- a/Question/ChoiceQuestion.php +++ b/Question/ChoiceQuestion.php @@ -150,7 +150,7 @@ private function getDefaultValidator(): callable } if (\count($results) > 1) { - throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results))); + throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of "%s".', implode('" or "', $results))); } $result = array_search($value, $choices); diff --git a/Tests/Helper/QuestionHelperTest.php b/Tests/Helper/QuestionHelperTest.php index 461318efe..139aa7290 100644 --- a/Tests/Helper/QuestionHelperTest.php +++ b/Tests/Helper/QuestionHelperTest.php @@ -630,7 +630,7 @@ public function testSelectChoiceFromChoiceList($providedAnswer, $expectedValue) public function testAmbiguousChoiceFromChoicelist() { $this->expectException('InvalidArgumentException'); - $this->expectExceptionMessage('The provided answer is ambiguous. Value should be one of env_2 or env_3.'); + $this->expectExceptionMessage('The provided answer is ambiguous. Value should be one of "env_2" or "env_3".'); $possibleChoices = [ 'env_1' => 'My first environment', 'env_2' => 'My environment', diff --git a/Tests/Helper/TableTest.php b/Tests/Helper/TableTest.php index c4acc3fbf..daa09feed 100644 --- a/Tests/Helper/TableTest.php +++ b/Tests/Helper/TableTest.php @@ -770,7 +770,7 @@ public function testColumnStyle() public function testThrowsWhenTheCellInAnArray() { $this->expectException('Symfony\Component\Console\Exception\InvalidArgumentException'); - $this->expectExceptionMessage('A cell must be a TableCell, a scalar or an object implementing __toString, array given.'); + $this->expectExceptionMessage('A cell must be a TableCell, a scalar or an object implementing "__toString()", "array" given.'); $table = new Table($output = $this->getOutputStream()); $table ->setHeaders(['ISBN', 'Title', 'Author', 'Price'])