Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a480dc6

Browse files
committed
feature #28397 [Messenger] Change exceptions to use component's one (fabpot)
This PR was merged into the 4.2-dev branch. Discussion ---------- [Messenger] Change exceptions to use component's one | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | n/a | License | MIT | Doc PR | n/a <!-- Write a short README entry for your feature/bugfix here (replace this comment block.) This will help people understand your PR and can be used as a start of the Doc PR. Additionally: - Bug fixes must be submitted against the lowest branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the master branch. --> Commits ------- 4e0e5e5 [Messenger] changed exceptions to use component's one
2 parents f6b4dc9 + 4e0e5e5 commit a480dc6

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

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

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

1212
namespace Symfony\Component\Messenger\Handler;
1313

14+
use Symfony\Component\Messenger\Exception\InvalidArgumentException;
15+
1416
/**
1517
* Represents a collection of message handlers.
1618
*
@@ -29,7 +31,7 @@ class ChainHandler
2931
public function __construct(array $handlers)
3032
{
3133
if (empty($handlers)) {
32-
throw new \InvalidArgumentException('A collection of message handlers requires at least one handler.');
34+
throw new InvalidArgumentException('A collection of message handlers requires at least one handler.');
3335
}
3436

3537
$this->handlers = $handlers;

src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php

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

1212
namespace Symfony\Component\Messenger\Transport\AmqpExt;
1313

14+
use Symfony\Component\Messenger\Exception\InvalidArgumentException;
15+
1416
/**
1517
* An AMQP connection.
1618
*
@@ -51,7 +53,7 @@ public function __construct(array $connectionCredentials, array $exchangeConfigu
5153
public static function fromDsn(string $dsn, array $options = array(), bool $debug = false, AmqpFactory $amqpFactory = null): self
5254
{
5355
if (false === $parsedUrl = parse_url($dsn)) {
54-
throw new \InvalidArgumentException(sprintf('The given AMQP DSN "%s" is invalid.', $dsn));
56+
throw new InvalidArgumentException(sprintf('The given AMQP DSN "%s" is invalid.', $dsn));
5557
}
5658

5759
$pathParts = isset($parsedUrl['path']) ? explode('/', trim($parsedUrl['path'], '/')) : array();

src/Symfony/Component/Messenger/Transport/Serialization/Serializer.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Messenger\Transport\Serialization;
1313

1414
use Symfony\Component\Messenger\Envelope;
15+
use Symfony\Component\Messenger\Exception\InvalidArgumentException;
1516
use Symfony\Component\Serializer\SerializerInterface;
1617

1718
/**
@@ -36,11 +37,11 @@ public function __construct(SerializerInterface $serializer, string $format = 'j
3637
public function decode(array $encodedEnvelope): Envelope
3738
{
3839
if (empty($encodedEnvelope['body']) || empty($encodedEnvelope['headers'])) {
39-
throw new \InvalidArgumentException('Encoded envelope should have at least a `body` and some `headers`.');
40+
throw new InvalidArgumentException('Encoded envelope should have at least a "body" and some "headers".');
4041
}
4142

4243
if (empty($encodedEnvelope['headers']['type'])) {
43-
throw new \InvalidArgumentException('Encoded envelope does not have a `type` header.');
44+
throw new InvalidArgumentException('Encoded envelope does not have a "type" header.');
4445
}
4546

4647
$envelopeItems = $this->decodeEnvelopeItems($encodedEnvelope);

src/Symfony/Component/Messenger/Transport/TransportFactory.php

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

1212
namespace Symfony\Component\Messenger\Transport;
1313

14+
use Symfony\Component\Messenger\Exception\InvalidArgumentException;
15+
1416
/**
1517
* @author Samuel Roze <[email protected]>
1618
*/
@@ -34,7 +36,7 @@ public function createTransport(string $dsn, array $options): TransportInterface
3436
}
3537
}
3638

37-
throw new \InvalidArgumentException(sprintf('No transport supports the given DSN "%s".', $dsn));
39+
throw new InvalidArgumentException(sprintf('No transport supports the given DSN "%s".', $dsn));
3840
}
3941

4042
public function supports(string $dsn, array $options): bool

0 commit comments

Comments
 (0)