Skip to content

Commit 8d2fa14

Browse files
committed
Merge branch '4.4' into 5.0
* 4.4: Fix quotes in exception messages Fix quotes in exception messages Fix quotes in exception messages
2 parents bc2b966 + fe39d1d commit 8d2fa14

File tree

10 files changed

+11
-11
lines changed

10 files changed

+11
-11
lines changed

Command/DebugCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(array $mapping)
4242
protected function configure()
4343
{
4444
$this
45-
->addArgument('bus', InputArgument::OPTIONAL, sprintf('The bus id (one of %s)', implode(', ', array_keys($this->mapping))))
45+
->addArgument('bus', InputArgument::OPTIONAL, sprintf('The bus id (one of "%s")', implode('", "', array_keys($this->mapping))))
4646
->setDescription('Lists messages you can dispatch using the message buses')
4747
->setHelp(<<<'EOF'
4848
The <info>%command.name%</info> command displays all messages that can be
@@ -70,7 +70,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
7070
$mapping = $this->mapping;
7171
if ($bus = $input->getArgument('bus')) {
7272
if (!isset($mapping[$bus])) {
73-
throw new RuntimeException(sprintf('Bus "%s" does not exist. Known buses are %s.', $bus, implode(', ', array_keys($this->mapping))));
73+
throw new RuntimeException(sprintf('Bus "%s" does not exist. Known buses are "%s".', $bus, implode('", "', array_keys($this->mapping))));
7474
}
7575
$mapping = [$bus => $mapping[$bus]];
7676
}

DependencyInjection/MessengerPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private function registerHandlers(ContainerBuilder $container, array $busIds)
7575
foreach ($container->findTaggedServiceIds($this->handlerTag, true) as $serviceId => $tags) {
7676
foreach ($tags as $tag) {
7777
if (isset($tag['bus']) && !\in_array($tag['bus'], $busIds, true)) {
78-
throw new RuntimeException(sprintf('Invalid handler service "%s": bus "%s" specified on the tag "%s" does not exist (known ones are: %s).', $serviceId, $tag['bus'], $this->handlerTag, implode(', ', $busIds)));
78+
throw new RuntimeException(sprintf('Invalid handler service "%s": bus "%s" specified on the tag "%s" does not exist (known ones are: "%s").', $serviceId, $tag['bus'], $this->handlerTag, implode('", "', $busIds)));
7979
}
8080

8181
$className = $container->getDefinition($serviceId)->getClass();

Envelope.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ final class Envelope
3030
public function __construct($message, array $stamps = [])
3131
{
3232
if (!\is_object($message)) {
33-
throw new \TypeError(sprintf('Invalid argument provided to "%s()": expected object but got %s.', __METHOD__, \gettype($message)));
33+
throw new \TypeError(sprintf('Invalid argument provided to "%s()": expected object but got "%s".', __METHOD__, \gettype($message)));
3434
}
3535
$this->message = $message;
3636

MessageBus.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function getIterator(): \Traversable
6262
public function dispatch($message, array $stamps = []): Envelope
6363
{
6464
if (!\is_object($message)) {
65-
throw new \TypeError(sprintf('Invalid argument provided to "%s()": expected object, but got %s.', __METHOD__, \gettype($message)));
65+
throw new \TypeError(sprintf('Invalid argument provided to "%s()": expected object, but got "%s".', __METHOD__, \gettype($message)));
6666
}
6767
$envelope = Envelope::wrap($message, $stamps);
6868
$middlewareIterator = $this->middlewareAggregate->getIterator();

Middleware/StackMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct($middlewareIterator = null)
3737
} elseif ($middlewareIterator instanceof MiddlewareInterface) {
3838
$this->stack->stack[] = $middlewareIterator;
3939
} elseif (!is_iterable($middlewareIterator)) {
40-
throw new \TypeError(sprintf('Argument 1 passed to %s() must be iterable of %s, %s given.', __METHOD__, MiddlewareInterface::class, \is_object($middlewareIterator) ? \get_class($middlewareIterator) : \gettype($middlewareIterator)));
40+
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be iterable of "%s", "%s" given.', __METHOD__, MiddlewareInterface::class, \is_object($middlewareIterator) ? \get_class($middlewareIterator) : \gettype($middlewareIterator)));
4141
} else {
4242
$this->stack->iterator = (function () use ($middlewareIterator) {
4343
yield from $middlewareIterator;

Tests/Command/DebugCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function testOutputWithoutMessages()
142142
public function testExceptionOnUnknownBusArgument()
143143
{
144144
$this->expectException('Symfony\Component\Console\Exception\RuntimeException');
145-
$this->expectExceptionMessage('Bus "unknown_bus" does not exist. Known buses are command_bus, query_bus.');
145+
$this->expectExceptionMessage('Bus "unknown_bus" does not exist. Known buses are "command_bus", "query_bus".');
146146
$command = new DebugCommand(['command_bus' => [], 'query_bus' => []]);
147147

148148
$tester = new CommandTester($command);

Tests/DependencyInjection/MessengerPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function testProcessHandlersByBus()
156156
public function testProcessTagWithUnknownBus()
157157
{
158158
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
159-
$this->expectExceptionMessage('Invalid handler service "Symfony\Component\Messenger\Tests\Fixtures\DummyCommandHandler": bus "unknown_bus" specified on the tag "messenger.message_handler" does not exist (known ones are: command_bus).');
159+
$this->expectExceptionMessage('Invalid handler service "Symfony\Component\Messenger\Tests\Fixtures\DummyCommandHandler": bus "unknown_bus" specified on the tag "messenger.message_handler" does not exist (known ones are: "command_bus").');
160160
$container = $this->getContainerBuilder($commandBusId = 'command_bus');
161161

162162
$container->register(DummyCommandHandler::class)->addTag('messenger.message_handler', ['bus' => 'unknown_bus']);

Tests/MessageBusTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testItHasTheRightInterface()
3535
public function testItDispatchInvalidMessageType()
3636
{
3737
$this->expectException('TypeError');
38-
$this->expectExceptionMessage('Invalid argument provided to "Symfony\Component\Messenger\MessageBus::dispatch()": expected object, but got string.');
38+
$this->expectExceptionMessage('Invalid argument provided to "Symfony\Component\Messenger\MessageBus::dispatch()": expected object, but got "string".');
3939
(new MessageBus())->dispatch('wrong');
4040
}
4141

Transport/AmqpExt/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ private static function normalizeQueueArguments(array $arguments): array
163163
}
164164

165165
if (!is_numeric($arguments[$key])) {
166-
throw new InvalidArgumentException(sprintf('Integer expected for queue argument "%s", %s given.', $key, \gettype($arguments[$key])));
166+
throw new InvalidArgumentException(sprintf('Integer expected for queue argument "%s", "%s" given.', $key, \gettype($arguments[$key])));
167167
}
168168

169169
$arguments[$key] = (int) $arguments[$key];

Transport/Doctrine/DoctrineTransportFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class DoctrineTransportFactory implements TransportFactoryInterface
2828
public function __construct($registry)
2929
{
3030
if (!$registry instanceof RegistryInterface && !$registry instanceof ConnectionRegistry) {
31-
throw new \TypeError(sprintf('Expected an instance of %s or %s, but got %s.', RegistryInterface::class, ConnectionRegistry::class, \is_object($registry) ? \get_class($registry) : \gettype($registry)));
31+
throw new \TypeError(sprintf('Expected an instance of "%s" or "%s", but got "%s".', RegistryInterface::class, ConnectionRegistry::class, \is_object($registry) ? \get_class($registry) : \gettype($registry)));
3232
}
3333

3434
$this->registry = $registry;

0 commit comments

Comments
 (0)