Skip to content

Commit

Permalink
Merge branch '4.4' into 5.0
Browse files Browse the repository at this point in the history
* 4.4:
  Fix quotes in exception messages
  Fix quotes in exception messages
  Fix quotes in exception messages
  • Loading branch information
fabpot committed Mar 16, 2020
2 parents bc2b966 + fe39d1d commit 8d2fa14
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Command/DebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(array $mapping)
protected function configure()
{
$this
->addArgument('bus', InputArgument::OPTIONAL, sprintf('The bus id (one of %s)', implode(', ', array_keys($this->mapping))))
->addArgument('bus', InputArgument::OPTIONAL, sprintf('The bus id (one of "%s")', implode('", "', array_keys($this->mapping))))
->setDescription('Lists messages you can dispatch using the message buses')
->setHelp(<<<'EOF'
The <info>%command.name%</info> command displays all messages that can be
Expand Down Expand Up @@ -70,7 +70,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$mapping = $this->mapping;
if ($bus = $input->getArgument('bus')) {
if (!isset($mapping[$bus])) {
throw new RuntimeException(sprintf('Bus "%s" does not exist. Known buses are %s.', $bus, implode(', ', array_keys($this->mapping))));
throw new RuntimeException(sprintf('Bus "%s" does not exist. Known buses are "%s".', $bus, implode('", "', array_keys($this->mapping))));
}
$mapping = [$bus => $mapping[$bus]];
}
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/MessengerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private function registerHandlers(ContainerBuilder $container, array $busIds)
foreach ($container->findTaggedServiceIds($this->handlerTag, true) as $serviceId => $tags) {
foreach ($tags as $tag) {
if (isset($tag['bus']) && !\in_array($tag['bus'], $busIds, true)) {
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)));
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)));
}

$className = $container->getDefinition($serviceId)->getClass();
Expand Down
2 changes: 1 addition & 1 deletion Envelope.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class Envelope
public function __construct($message, array $stamps = [])
{
if (!\is_object($message)) {
throw new \TypeError(sprintf('Invalid argument provided to "%s()": expected object but got %s.', __METHOD__, \gettype($message)));
throw new \TypeError(sprintf('Invalid argument provided to "%s()": expected object but got "%s".', __METHOD__, \gettype($message)));
}
$this->message = $message;

Expand Down
2 changes: 1 addition & 1 deletion MessageBus.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function getIterator(): \Traversable
public function dispatch($message, array $stamps = []): Envelope
{
if (!\is_object($message)) {
throw new \TypeError(sprintf('Invalid argument provided to "%s()": expected object, but got %s.', __METHOD__, \gettype($message)));
throw new \TypeError(sprintf('Invalid argument provided to "%s()": expected object, but got "%s".', __METHOD__, \gettype($message)));
}
$envelope = Envelope::wrap($message, $stamps);
$middlewareIterator = $this->middlewareAggregate->getIterator();
Expand Down
2 changes: 1 addition & 1 deletion Middleware/StackMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct($middlewareIterator = null)
} elseif ($middlewareIterator instanceof MiddlewareInterface) {
$this->stack->stack[] = $middlewareIterator;
} elseif (!is_iterable($middlewareIterator)) {
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)));
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)));
} else {
$this->stack->iterator = (function () use ($middlewareIterator) {
yield from $middlewareIterator;
Expand Down
2 changes: 1 addition & 1 deletion Tests/Command/DebugCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function testOutputWithoutMessages()
public function testExceptionOnUnknownBusArgument()
{
$this->expectException('Symfony\Component\Console\Exception\RuntimeException');
$this->expectExceptionMessage('Bus "unknown_bus" does not exist. Known buses are command_bus, query_bus.');
$this->expectExceptionMessage('Bus "unknown_bus" does not exist. Known buses are "command_bus", "query_bus".');
$command = new DebugCommand(['command_bus' => [], 'query_bus' => []]);

$tester = new CommandTester($command);
Expand Down
2 changes: 1 addition & 1 deletion Tests/DependencyInjection/MessengerPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function testProcessHandlersByBus()
public function testProcessTagWithUnknownBus()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
$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).');
$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").');
$container = $this->getContainerBuilder($commandBusId = 'command_bus');

$container->register(DummyCommandHandler::class)->addTag('messenger.message_handler', ['bus' => 'unknown_bus']);
Expand Down
2 changes: 1 addition & 1 deletion Tests/MessageBusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testItHasTheRightInterface()
public function testItDispatchInvalidMessageType()
{
$this->expectException('TypeError');
$this->expectExceptionMessage('Invalid argument provided to "Symfony\Component\Messenger\MessageBus::dispatch()": expected object, but got string.');
$this->expectExceptionMessage('Invalid argument provided to "Symfony\Component\Messenger\MessageBus::dispatch()": expected object, but got "string".');
(new MessageBus())->dispatch('wrong');
}

Expand Down
2 changes: 1 addition & 1 deletion Transport/AmqpExt/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private static function normalizeQueueArguments(array $arguments): array
}

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

$arguments[$key] = (int) $arguments[$key];
Expand Down
2 changes: 1 addition & 1 deletion Transport/Doctrine/DoctrineTransportFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DoctrineTransportFactory implements TransportFactoryInterface
public function __construct($registry)
{
if (!$registry instanceof RegistryInterface && !$registry instanceof ConnectionRegistry) {
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)));
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)));
}

$this->registry = $registry;
Expand Down

0 comments on commit 8d2fa14

Please sign in to comment.