Skip to content

Commit be9f002

Browse files
committed
Change a bit of wording and add dots at the end of each exception
1 parent d017eab commit be9f002

File tree

10 files changed

+24
-24
lines changed

10 files changed

+24
-24
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/MessageConsumeCommand.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@ protected function configure()
3838
new InputArgument('receiver', InputArgument::REQUIRED, 'Name of the receiver'),
3939
new InputOption('bus', 'b', InputOption::VALUE_REQUIRED, 'Name of the bus to dispatch the messages to', 'message_bus'),
4040
))
41-
->setDescription('Consume a message')
41+
->setDescription('Consumes a message')
4242
->setHelp(<<<'EOF'
43-
The <info>%command.name%</info> command consume a message and dispatch it to the message bus.
44-
45-
%command.full_name% <consumer-service-name>
43+
The <info>%command.name%</info> command consumes a message and dispatches it to the message bus.
4644
45+
<info>php %command.full_name% <consumer-service-name></info>
4746
EOF
4847
)
4948
;
@@ -58,15 +57,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
5857
$container = $this->getApplication()->getKernel()->getContainer();
5958

6059
if (!$container->has($receiverName = $input->getArgument('receiver'))) {
61-
throw new \RuntimeException(sprintf('Receiver "%s" does not exist', $receiverName));
60+
throw new \RuntimeException(sprintf('Receiver "%s" does not exist.', $receiverName));
6261
} elseif (!($receiver = $container->get($receiverName)) instanceof ReceiverInterface) {
63-
throw new \RuntimeException(sprintf('Receiver "%s" is not a valid message consumer. It must implement the interface "%s"', $receiverName, ReceiverInterface::class));
62+
throw new \RuntimeException(sprintf('Receiver "%s" is not a valid message consumer. It must implement the "%s" interface.', $receiverName, ReceiverInterface::class));
6463
}
6564

6665
if (!$container->has($busName = $input->getOption('bus'))) {
67-
throw new \RuntimeException(sprintf('Bus "%s" does not exist', $busName));
66+
throw new \RuntimeException(sprintf('Bus "%s" does not exist.', $busName));
6867
} elseif (!($messageBus = $container->get($busName)) instanceof MessageBusInterface) {
69-
throw new \RuntimeException(sprintf('Bus "%s" is not a valid message bus. It must implement the interface "%s"', $busName, MessageBusInterface::class));
68+
throw new \RuntimeException(sprintf('Bus "%s" is not a valid message bus. It must implement the "%s" interface.', $busName, MessageBusInterface::class));
7069
}
7170

7271
$worker = new Worker($receiver, $messageBus);

src/Symfony/Component/Message/Asynchronous/Transport/ReceivedMessage.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111

1212
namespace Symfony\Component\Message\Asynchronous\Transport;
1313

14+
use Symfony\Component\Message\Asynchronous\Middleware\SendMessageMiddleware;
15+
1416
/**
1517
* Wraps a received message. This is mainly used by the `SendMessageMiddleware` middleware to identify
1618
* a message should not be sent if it was just received.
1719
*
18-
* @see \Symfony\Component\Message\Asynchronous\Middleware\SendMessageMiddleware
20+
* @see SendMessageMiddleware
1921
*
2022
* @author Samuel Roze <samuel.roze@gmail.com>
2123
*/

src/Symfony/Component/Message/ContainerHandlerLocator.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
*/
2121
class ContainerHandlerLocator implements HandlerLocatorInterface
2222
{
23-
/**
24-
* @var ContainerInterface
25-
*/
2623
private $container;
2724

2825
public function __construct(ContainerInterface $container)
@@ -35,7 +32,7 @@ public function resolve($message): callable
3532
$messageKey = get_class($message);
3633

3734
if (!$this->container->has($messageKey)) {
38-
throw new NoHandlerForMessageException(sprintf('No handler for message "%s"', $messageKey));
35+
throw new NoHandlerForMessageException(sprintf('No handler for message "%s".', $messageKey));
3936
}
4037

4138
return $this->container->get($messageKey);

src/Symfony/Component/Message/DependencyInjection/MessagePass.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private function registerHandlers(ContainerBuilder $container)
5959
$handles = isset($tag['handles']) ? $tag['handles'] : $this->guessHandledClass($container, $serviceId);
6060

6161
if (!class_exists($handles)) {
62-
throw new RuntimeException(sprintf('The message class "%s" declared in `__invoke` function of service "%s" does not exist', $handles, $serviceId));
62+
throw new RuntimeException(sprintf('The message class "%s" declared in `__invoke` function of service "%s" does not exist.', $handles, $serviceId));
6363
}
6464

6565
$priority = isset($tag['priority']) ? $tag['priority'] : 0;
@@ -96,17 +96,17 @@ private function guessHandledClass(ContainerBuilder $container, string $serviceI
9696
try {
9797
$method = $reflection->getMethod('__invoke');
9898
} catch (\ReflectionException $e) {
99-
throw new RuntimeException(sprintf('Service "%s" should have an `__invoke` function', $serviceId));
99+
throw new RuntimeException(sprintf('Service "%s" should have an `__invoke` function.', $serviceId));
100100
}
101101

102102
$parameters = $method->getParameters();
103103
if (1 !== count($parameters)) {
104-
throw new RuntimeException(sprintf('`__invoke` function of service "%s" must have exactly one parameter', $serviceId));
104+
throw new RuntimeException(sprintf('`__invoke` function of service "%s" must have exactly one parameter.', $serviceId));
105105
}
106106

107107
$parameter = $parameters[0];
108108
if (null === $parameter->getClass()) {
109-
throw new RuntimeException(sprintf('The parameter of `__invoke` function of service "%s" must type hint the Message class it handles', $serviceId));
109+
throw new RuntimeException(sprintf('The parameter of `__invoke` function of service "%s" must type hint the Message class it handles.', $serviceId));
110110
}
111111

112112
return $parameter->getClass()->getName();

src/Symfony/Component/Message/Handler/ChainHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ChainHandler
2929
public function __construct(array $handlers)
3030
{
3131
if (empty($handlers)) {
32-
throw new \InvalidArgumentException('A collection of message handlers requires at least one handler');
32+
throw new \InvalidArgumentException('A collection of message handlers requires at least one handler.');
3333
}
3434

3535
$this->handlers = $handlers;

src/Symfony/Component/Message/HandlerLocator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function resolve($message): callable
3636
$messageKey = get_class($message);
3737

3838
if (!isset($this->messageToHandlerMapping[$messageKey])) {
39-
throw new NoHandlerForMessageException(sprintf('No handler for message "%s"', $messageKey));
39+
throw new NoHandlerForMessageException(sprintf('No handler for message "%s".', $messageKey));
4040
}
4141

4242
$handler = $this->messageToHandlerMapping[$messageKey];

src/Symfony/Component/Message/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class ImportantActionToEmailSender implements SenderInterface
162162
public function send($message)
163163
{
164164
if (!$message instanceof ImportantAction) {
165-
throw new \InvalidArgumentException(sprintf('Producer only supports "%s" messages', ImportantAction::class));
165+
throw new \InvalidArgumentException(sprintf('Producer only supports "%s" messages.', ImportantAction::class));
166166
}
167167
168168
$this->mailer->send(

src/Symfony/Component/Message/Transport/Serialization/DecoderInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
interface DecoderInterface
1818
{
1919
/**
20-
* Decode the message from an encoded-form. The `$encodedMessage` parameter is a key-value array that
20+
* Decodes the message from an encoded-form.
21+
*
22+
* The `$encodedMessage` parameter is a key-value array that
2123
* describes the message, that will be used by the different adapters.
2224
*
2325
* The most common keys are:

src/Symfony/Component/Message/Transport/Serialization/EncoderInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
interface EncoderInterface
1818
{
1919
/**
20-
* Encode a message to a common format understandable by adapters. The encoded array should only
20+
* Encodes a message to a common format understandable by adapters. The encoded array should only
2121
* contain scalar and arrays.
2222
*
2323
* The most common keys of the encoded array are:

src/Symfony/Component/Message/Transport/Serialization/SymfonySerialization.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public function __construct(SerializerInterface $serializer, string $format = 'j
4040
public function decode(array $encodedMessage)
4141
{
4242
if (empty($encodedMessage['body']) || empty($encodedMessage['headers'])) {
43-
throw new \InvalidArgumentException('Encoded message should have at least a `body` some `headers`');
43+
throw new \InvalidArgumentException('Encoded message should have at least a `body` some `headers`.');
4444
} elseif (empty($encodedMessage['headers']['type'])) {
45-
throw new \InvalidArgumentException('Encoded message does not have a `type` header');
45+
throw new \InvalidArgumentException('Encoded message does not have a `type` header.');
4646
}
4747

4848
return $this->serializer->deserialize($encodedMessage['body'], $encodedMessage['headers']['type'], $this->format);

0 commit comments

Comments
 (0)