8000 Fix quotes in exception messages · symfony/symfony@6c37f66 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6c37f66

Browse files
committed
Fix quotes in exception messages
1 parent 1866a2a commit 6c37f66

File tree

11 files changed

+17
-17
lines changed

11 files changed

+17
-17
lines changed

src/Symfony/Component/Cache/Adapter/CouchbaseBucketAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static function createConnection($servers, array $options = []): \Couchba
6262
if (\is_string($servers)) {
6363
$servers = [$servers];
6464
} elseif (!\is_array($servers)) {
65-
throw new \TypeError(sprintf('Argument 1 passed to %s() must be array or string, %s given.', __METHOD__, \gettype($servers)));
65+
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be array or string, "%s" given.', __METHOD__, \gettype($servers)));
6666
}
6767

6868
if (!static::isSupported()) {
@@ -83,7 +83,7 @@ public static function createConnection($servers, array $options = []): \Couchba
8383

8484
foreach ($servers as $dsn) {
8585
if (0 !== strpos($dsn, 'couchbase:')) {
86-
throw new InvalidArgumentException(sprintf('Invalid Couchbase DSN: %s does not start with "couchbase:".', $dsn));
86+
throw new InvalidArgumentException(sprintf('Invalid Couchbase DSN: "%s" does not start with "couchbase:".', $dsn));
8787
}
8888

8989
preg_match($dsnPattern, $dsn, $matches);

src/Symfony/Component/HttpClient/Internal/AmpBody.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ private function doRead(): Promise
133133
}
134134

135135
if (!\is_string($data)) {
136-
throw new TransportException(sprintf('Return value of the "body" option callback must be string, %s returned.', \gettype($data)));
136+
throw new TransportException(sprintf('Return value of the "body" option callback must be string, "%s" returned.', \gettype($data)));
137137
}
138138

139139
return new Success($data);

src/Symfony/Component/HttpClient/NoPrivateNetworkHttpClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ final class NoPrivateNetworkHttpClient implements HttpClientInterface, LoggerAwa
5454
public function __construct(HttpClientInterface $client, $subnets = null)
5555
{
5656
if (!(\is_array($subnets) || \is_string($subnets) || null === $subnets)) {
57-
throw new \TypeError(sprintf('Argument 2 passed to %s() must be of the type array, string or null. %s given.', __METHOD__, \is_object($subnets) ? \get_class($subnets) : \gettype($subnets)));
57+
throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be of the type array, string or null. "%s" given.', __METHOD__, \is_object($subnets) ? \get_class($subnets) : \gettype($subnets)));
5858
}
5959

6060
if (!class_exists(IpUtils::class)) {
@@ -72,7 +72,7 @@ public function request(string $method, string $url, array $options = []): Respo
7272
{
7373
$onProgress = $options['on_progress'] ?? null;
7474
if (null !== $onProgress && !\is_callable($onProgress)) {
75-
throw new InvalidArgumentException(sprintf('Option "on_progress" must be callable, %s given.', \is_object($onProgress) ? \get_class($onProgress) : \gettype($onProgress)));
75+
throw new InvalidArgumentException(sprintf('Option "on_progress" must be callable, "%s" given.', \is_object($onProgress) ? \get_class($onProgress) : \gettype($onProgress)));
7676
}
7777

7878
$subnets = $this->subnets;

src/Symfony/Component/HttpClient/Tests/NoPrivateNetworkHttpClientTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function testNonCallableOnProgressCallback()
113113
$customCallback = sprintf('cb_%s', microtime(true));
114114

115115
$this->expectException(InvalidArgumentException::class);
116-
$this->expectExceptionMessage('Option "on_progress" must be callable, string given.');
116+
$this->expectExceptio 9E88 nMessage('Option "on_progress" must be callable, "string" given.');
117117

118118
$client = new NoPrivateNetworkHttpClient(new MockHttpClient());
119119
$client->request('GET', $url, ['on_progress' => $customCallback]);
@@ -122,7 +122,7 @@ public function testNonCallableOnProgressCallback()
122122
public function testConstructor()
123123
{
124124
$this->expectException(\TypeError::class);
125-
$this->expectExceptionMessage('Argument 2 passed to Symfony\Component\HttpClient\NoPrivateNetworkHttpClient::__construct() must be of the type array, string or null. integer given.');
125+
$this->expectExceptionMessage('Argument 2 passed to "Symfony\Component\HttpClient\NoPrivateNetworkHttpClient::__construct()" must be of the type array, string or null. "integer" given.');
126126

127127
new NoPrivateNetworkHttpClient(new MockHttpClient(), 3);
128128
}

src/Symfony/Component/HttpClient/TraceableHttpClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ public function stream($responses, float $timeout = null): ResponseStreamInterfa
6767
if ($responses instanceof TraceableResponse) {
6868
$responses = [$responses];
6969
} elseif (!is_iterable($responses)) {
70-
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of TraceableResponse objects, %s given.', __METHOD__, \is_object($responses) ? \get_class($responses) : \gettype($responses)));
70+
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of TraceableResponse objects, "%s" given.', __METHOD__, \is_object($responses) ? \get_class($responses) : \gettype($responses)));
7171
}
7272

7373
return $this->client->stream(\Closure::bind(static function () use ($responses) {
7474
foreach ($responses as $k => $r) {
7575
if (!$r instanceof TraceableResponse) {
76-
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of TraceableResponse objects, %s given.', __METHOD__, \is_object($r) ? \get_class($r) : \gettype($r)));
76+
throw new \TypeError(sprintf('%s() expects parameter 1 to be an iterable of TraceableResponse objects, "%s" given.', __METHOD__, \is_object($r) ? \get_class($r) : \gettype($r)));
7777
}
7878

7979
yield $k => $r->response;

src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php

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

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

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

src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/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;

src/Symfony/Component/String/LazyString.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class LazyString implements \Stringable, \JsonSerializable
2828
public static function fromCallable($callback, ...$arguments): self
2929
{
3030
if (!\is_callable($callback) && !(\is_array($callback) && isset($callback[0]) && $callback[0] instanceof \Closure && 2 >= \count($callback))) {
31-
throw new \TypeError(sprintf('Argument 1 passed to %s() must be a callable or a [Closure, method] lazy-callable, %s given.', __METHOD__, \gettype($callback)));
31+
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a callable or a [Closure, method] lazy-callable, "%s" given.', __METHOD__, \gettype($callback)));
3232
}
3333

3434
$lazyString = new static();
@@ -57,7 +57,7 @@ public static function fromCallable($callback, ...$arguments): self
5757
public static function fromStringable($value): self
5858
{
5959
if (!self::isStringable($value)) {
60-
throw new \TypeError(sprintf('Argument 1 passed to %s() must be a scalar or a stringable object, %s given.', __METHOD__, \is_object($value) ? \get_class($value) : \gettype($value)));
60+
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be a scalar or a stringable object, "%s" given.', __METHOD__, \is_object($value) ? \get_class($value) : \gettype($value)));
6161
}
6262

6363
if (\is_object($value)) {

src/Symfony/Component/Validator/Constraints/Compound.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ abstract class Compound extends Composite
2727
public function __construct($options = null)
2828
{
2929
if (isset($options[$this->getCompositeOption()])) {
30-
throw new ConstraintDefinitionException(sprintf('You can\'t redefine the "%s" option. Use the %s::getConstraints() method instead.', $this->getCompositeOption(), __CLASS__));
30+
throw new ConstraintDefinitionException(sprintf('You can\'t redefine the "%s" option. Use the "%s::getConstraints()" method instead.', $this->getCompositeOption(), __CLASS__));
3131
}
3232

3333
$this->constraints = $this->getConstraints($this->normalizeOptions($options));

src/Symfony/Component/Validator/Tests/Constraints/CompoundTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class CompoundTest extends TestCase
2222
public function testItCannotRedefineConstraintsOption()
2323
{
2424
$this->expectException(ConstraintDefinitionException::class);
25-
$this->expectExceptionMessage('You can\'t redefine the "constraints" option. Use the Symfony\Component\Validator\Constraints\Compound::getConstraints() method instead.');
25+
$this->expectExceptionMessage('You can\'t redefine the "constraints" option. Use the "Symfony\Component\Validator\Constraints\Compound::getConstraints()" method instead.');
2626
new EmptyCompound(['constraints' => [new NotBlank()]]);
2727
}
2828

src/Symfony/Component/Validator/Tests/Constraints/SequentiallyTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class SequentiallyTest extends TestCase
2121
public function testRejectNonConstraints()
2222
{
2323
$this->expectException(ConstraintDefinitionException::class);
24-
$this->expectExceptionMessage('The value foo is not an instance of Constraint in constraint Symfony\Component\Validator\Constraints\Sequentially');
24+
$this->expectExceptionMessage('The value "foo" is not an instance of Constraint in constraint "Symfony\Component\Validator\Constraints\Sequentially"');
2525
new Sequentially([
2626
'foo',
2727
]);
@@ -30,7 +30,7 @@ public function testRejectNonConstraints()
3030
public function testRejectValidConstraint()
3131
{
3232
$this->expectException(ConstraintDefinitionException::class);
33-
$this->expectExceptionMessage('The constraint Valid cannot be nested inside constraint Symfony\Component\Validator\Constraints\Sequentially');
33+
$this->expectExceptionMessage('The constraint Valid cannot be nested inside constraint "Symfony\Component\Validator\Constraints\Sequentially"');
3434
new Sequentially([
3535
new Valid(),
3636
]);

0 commit comments

Comments
 (0)
0