8000 Merge branch '5.0' · symfony/symfony@1866a2a · GitHub
[go: up one dir, main page]

Skip to content

Commit 1866a2a

Browse files
committed
Merge branch '5.0'
* 5.0: Fix quotes in exception messages Fix quotes in exception messages Fix quotes in exception messages Fix quotes in exception messages Fix quotes in exception messages
2 parents eda7aad + 4efa287 commit 1866a2a

File tree

161 files changed

+299
-299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+299
-299
lines changed

src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ private function validateAutoMapping(array $managerConfigs): ?string
429429
}
430430

431431
if (null !== $autoMappedManager) {
432-
throw new \LogicException(sprintf('You cannot enable "auto_mapping" on more than one manager at the same time (found in "%s" and %s").', $autoMappedManager, $name));
432+
throw new \LogicException(sprintf('You cannot enable "auto_mapping" on more than one manager at the same time (found in "%s" and "%s"").', $autoMappedManager, $name));
433433
}
434434

435435
$autoMappedManager = $name;

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private function addTaggedSubscribers(ContainerBuilder $container)
6969
$connections = isset($tag['connection']) ? [$tag['connection']] : array_keys($this->connections);
7070
foreach ($connections as $con) {
7171
if (!isset($this->connections[$con])) {
72-
throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s.', $con, $id, implode(', ', array_keys($this->connections))));
72+
throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: "%s".', $con, $id, implode('", "', array_keys($this->connections))));
7373
}
7474

7575
$this->getEventManagerDef($container, $con)->addMethodCall('addEventSubscriber', [new Reference($id)]);
@@ -92,7 +92,7 @@ private function addTaggedListeners(ContainerBuilder $container)
9292
$connections = isset($tag['connection']) ? [$tag['connection']] : array_keys($this->connections);
9393
foreach ($connections as $con) {
9494
if (!isset($this->connections[$con])) {
95-
throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s.', $con, $id, implode(', ', array_keys($this->connections))));
95+
throw new RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: "%s".', $con, $id, implode('", "', array_keys($this->connections))));
9696
}
9797
$listenerRefs[$con][$id] = new Reference($id);
9898

src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function configureOptions(OptionsResolver $resolver)
5353
public function getLoader(ObjectManager $manager, $queryBuilder, string $class)
5454
{
5555
if (!$queryBuilder instanceof QueryBuilder) {
56-
throw new \TypeError(sprintf('Expected an instance of %s, but got %s.', QueryBuilder::class, \is_object($queryBuilder) ? \get_class($queryBuilder) : \gettype($queryBuilder)));
56+
throw new \TypeError(sprintf('Expected an instance of "%s", but got "%s".', QueryBuilder::class, \is_object($queryBuilder) ? \get_class($queryBuilder) : \gettype($queryBuilder)));
5757
}
5858

5959
return new ORMQueryBuilderLoader($queryBuilder);
@@ -79,7 +79,7 @@ public function getBlockPrefix()
7979
public function getQueryBuilderPartsForCachingHash($queryBuilder): ?array
8080
{
8181
if (!$queryBuilder instanceof QueryBuilder) {
82-
throw new \TypeError(sprintf('Expected an instance of %s, but got %s.', QueryBuilder::class, \is_object($queryBuilder) ? \get_class($queryBuilder) : \gettype($queryBuilder)));
82+
throw new \TypeError(sprintf('Expected an instance of "%s", but got "%s".', QueryBuilder::class, \is_object($queryBuilder) ? \get_class($queryBuilder) : \gettype($queryBuilder)));
8383
}
8484

8585
return [

src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function convertToDatabaseValue($value, AbstractPlatform $platform)
5050
return null;
5151
}
5252
if (!$value instanceof Foo) {
53-
throw new ConversionException(sprintf('Expected %s, got %s', 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\Foo', \gettype($value)));
53+
throw new ConversionException(sprintf('Expected "%s", got "%s"', 'Symfony\Bridge\Doctrine\Tests\PropertyInfo\Fixtures\Foo', \gettype($value)));
5454
}
5555

5656
return $foo->bar;

src/Symfony/Bridge/Monolog/Handler/ElasticsearchLogstashHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ElasticsearchLogstashHandler extends AbstractHandler
5252
public function __construct(string $endpoint = 'http://127.0.0.1:9200', string $index = 'monolog', HttpClientInterface $client = null, int $level = Logger::DEBUG, bool $bubble = true)
5353
{
5454
if (!interface_exists(HttpClientInterface::class)) {
55-
throw new \LogicException(sprintf('The %s handler needs an HTTP client. Try running "composer require symfony/http-client".', __CLASS__));
55+
throw new \LogicException(sprintf('The "%s" handler needs an HTTP client. Try running "composer require symfony/http-client".', __CLASS__));
5656
}
5757

5858
parent::__construct($level, $bubble);

src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function generate(\ReflectionClass $originalClass, ClassGenerator $classG
8888
$newBody = preg_replace('/^(\$this->initializer[a-zA-Z0-9]++) && .*;\n\nreturn (\$this->valueHolder)/', '$1 || $2', $body);
8989

9090
if ($body === $newBody) {
91-
throw new \UnexpectedValueException(sprintf('Unexpected lazy-proxy format generated for method %s::__destruct().', $originalClass->name));
91+
throw new \UnexpectedValueException(sprintf('Unexpected lazy-proxy format generated for method "%s::__destruct()".', $originalClass->name));
9292
}
9393

9494
$destructor->setBody($newBody);

src/Symfony/Bridge/Twig/ErrorRenderer/TwigErrorRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class TwigErrorRenderer implements ErrorRendererInterface
3535
public function __construct(Environment $twig, HtmlErrorRenderer $fallbackErrorRenderer = null, $debug = false)
3636
{
3737
if (!\is_bool($debug) && !\is_callable($debug)) {
38-
throw new \TypeError(sprintf('Argument 3 passed to %s() must be a boolean or a callable, %s given.', __METHOD__, \is_object($debug) ? \get_class($debug) : \gettype($debug)));
38+
throw new \TypeError(sprintf('Argument 3 passed to "%s()" must be a boolean or a callable, "%s" given.', __METHOD__, \is_object($debug) ? \get_class($debug) : \gettype($debug)));
3939
}
4040

4141
$this->twig = $twig;

src/Symfony/Bridge/Twig/Mime/NotificationEmail.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(Headers $headers = null, AbstractPart $body = null)
5151
}
5252

5353
if ($missingPackages) {
54-
throw new \LogicException(sprintf('You cannot use "%s" if the %s Twig extension%s not available; try running "composer require %s".', static::class, implode(' and ', $missingPackages), \count($missingPackages) > 1 ? 's are' : ' is', implode(' ', array_keys($missingPackages))));
54+
throw new \LogicException(sprintf('You cannot use "%s" if the "%s" Twig extension%s not available; try running "composer require "%s"".', static::class, implode('" and "', $missingPackages), \count($missingPackages) > 1 ? 's are' : ' is', implode(' ', array_keys($missingPackages))));
5555
}
5656

5757
parent::__construct($headers, $body);

src/Symfony/Bundle/FrameworkBundle/CacheWarmer/RouterCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function warmUp(string $cacheDir)
4747
return;
4848
}
4949

50-
throw new \LogicException(sprintf('The router %s cannot be warmed up because it does not implement %s.', \get_class($router), WarmableInterface::class));
50+
throw new \LogicException(sprintf('The router "%s" cannot be warmed up because it does not implement "%s".', \get_class($router), WarmableInterface::class));
5151
}
5252

5353
/**

src/Symfony/Bundle/FrameworkBundle/Routing/Router.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ private function resolve($value)
171171
return (string) $this->resolve($resolved);
172172
}
173173

174-
throw new RuntimeException(sprintf('The container parameter "%s", used in the route configuration value "%s", must be a string or numeric, but it is of type %s.', $match[1], $value, \gettype($resolved)));
174+
throw new RuntimeException(sprintf('The container parameter "%s", used in the route configuration value "%s", must be a string or numeric, but it is of type "%s".', $match[1], $value, \gettype($resolved)));
175175
}, $value);
176176

177177
return str_replace('%%', '%', $escapedValue);

src/Symfony/Bundle/FrameworkBundle/Secrets/SodiumVault.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class SodiumVault extends AbstractVault implements EnvVarLoaderInterface
3434
public function __construct(string $secretsDir, $decryptionKey = null)
3535
{
3636
if (null !== $decryptionKey && !\is_string($decryptionKey) && !(\is_object($decryptionKey) && method_exists($decryptionKey, '__toString'))) {
37-
throw new \TypeError(sprintf('Decryption key should be a string or an object that implements the __toString() method, %s given.', \gettype($decryptionKey)));
37+
throw new \TypeError(sprintf('Decryption key should be a string or an object that implements the __toString() method, "%s" given.', \gettype($decryptionKey)));
3838
}
3939

4040
$this->pathPrefix = rtrim(strtr($secretsDir, '/', \DIRECTORY_SEPARATOR), \DIRECTORY_SEPARATOR).\DIRECTORY_SEPARATOR.basename($secretsDir).'.';

src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ protected function tearDown(): void
5757
protected static function getKernelClass()
5858
{
5959
if (!isset($_SERVER['KERNEL_CLASS']) && !isset($_ENV['KERNEL_CLASS'])) {
60-
throw new \LogicException(sprintf('You must set the KERNEL_CLASS environment variable to the fully-qualified class name of your Kernel in phpunit.xml / phpunit.xml.dist or override the %1$s::createKernel() or %1$s::getKernelClass() method.', static::class));
60+
throw new \LogicException(sprintf('You must set the KERNEL_CLASS environment variable to the fully-qualified class name of your Kernel in phpunit.xml / phpunit.xml.dist or override the "%1$s::createKernel()" or "%1$s::getKernelClass()" method.', static::class));
6161
}
6262

6363
if (!class_exists($class = $_ENV['KERNEL_CLASS'] ?? $_SERVER['KERNEL_CLASS'])) {
64-
throw new \RuntimeException(sprintf('Class "%s" doesn\'t exist or cannot be autoloaded. Check that the KERNEL_CLASS value in phpunit.xml matches the fully-qualified class name of your Kernel or override the %s::createKernel() method.', $class, static::class));
64+
throw new \RuntimeException(sprintf('Class "%s" doesn\'t exist or cannot be autoloaded. Check that the KERNEL_CLASS value in phpunit.xml matches the fully-qualified class name of your Kernel or override the "%s::createKernel()" method.', $class, static::class));
6565
}
6666

6767
return $class;

src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected function tearDown(): void
4040
protected static function createClient(array $options = [], array $server = [])
4141
{
4242
if (static::$booted) {
43-
throw new \LogicException(sprintf('Booting the kernel before calling %s() is not supported, the kernel should only be booted once.', __METHOD__));
43+
throw new \LogicException(sprintf('Booting the kernel before calling "%s()" is not supported, the kernel should only be booted once.', __METHOD__));
4444
}
4545

4646
$kernel = static::bootKernel($options);

src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/RouterCacheWarmerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function testWarmUpWithoutWarmebleInterface()
4040
$containerMock->expects($this->any())->method('get')->with('router')->willReturn($routerMock);
4141
$routerCacheWarmer = new RouterCacheWarmer($containerMock);
4242
$this->expectException(\LogicException::class);
43-
$this->expectExceptionMessage('cannot be warmed up because it does not implement Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface');
43+
$this->expectExceptionMessage('cannot be warmed up because it does not implement "Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface"');
4444
$routerCacheWarmer->warmUp('/tmp');
4545
}
4646
}

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TestAbstractController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ public function setContainer(ContainerInterface $container): ?ContainerInterface
4141
continue;
4242
}
4343
if (!isset($expected[$id])) {
44-
throw new \UnexpectedValueException(sprintf('Service "%s" is not expected, as declared by %s::getSubscribedServices()', $id, AbstractController::class));
44+
throw new \UnexpectedValueException(sprintf('Service "%s" is not expected, as declared by "%s::getSubscribedServices()".', $id, AbstractController::class));
4545
}
4646
$type = substr($expected[$id], 1);
4747
if (!$container->get($id) instanceof $type) {
48-
throw new \UnexpectedValueException(sprintf('Service "%s" is expected to be an instance of "%s", as declared by %s::getSubscribedServices()', $id, $type, AbstractController::class));
48+
throw new \UnexpectedValueException(sprintf('Service "%s" is expected to be an instance of "%s", as declared by "%s::getSubscribedServices()".', $id, $type, AbstractController::class));
4949
}
5050
}
5151

src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ public function testExceptionOnNonExistentParameterWithSfContainer()
390390
public function testExceptionOnNonStringParameter()
391391
{
392392
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
393-
$this->expectExceptionMessage('The container parameter "object", used in the route configuration value "/%object%", must be a string or numeric, but it is of type object.');
393+
$this->expectExceptionMessage('The container parameter "object", used in the route configuration value "/%object%", must be a string or numeric, but it is of type "object".');
394394
$routes = new RouteCollection();
395395

396396
$routes->add('foo', new Route('/%object%'));
@@ -405,7 +405,7 @@ public function testExceptionOnNonStringParameter()
405405
public function testExceptionOnNonStringParameterWithSfContainer()
406406
{
407407
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
408-
$this->expectExceptionMessage('The container parameter "object", used in the route configuration value "/%object%", must be a string or numeric, but it is of type object.');
408+
$this->expectExceptionMessage('The container parameter "object", used in the route configuration value "/%object%", must be a string or numeric, but it is of type "object".');
409409
$routes = new RouteCollection();
410410

411411
$routes->add('foo', new Route('/%object%'));

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Compiler/AddSecurityVotersPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function process(ContainerBuilder $container)
5252
$class = $container->getParameterBag()->resolveValue($definition->getClass());
5353

5454
if (!is_a($class, VoterInterface::class, true)) {
55-
throw new LogicException(sprintf('%s must implement the %s when used as a voter.', $class, VoterInterface::class));
55+
throw new LogicException(sprintf('"%s" must implement the "%s" when used as a voter.', $class, VoterInterface::class));
5656
}
5757

5858
if ($debug) {

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Compiler/AddSecurityVotersPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function testThatVotersAreNotTraceableWithoutDebugMode(): void
130130
public function testVoterMissingInterface()
131131
{
132132
$exception = LogicException::class;
133-
$message = 'stdClass must implement the Symfony\Component\Security\Core\Authorization\Voter\VoterInterface when used as a voter.';
133+
$message = '"stdClass" must implement the "Symfony\Component\Security\Core\Authorization\Voter\VoterInterface" when used as a voter.';
134134

135135
$this->expectException($exception);
136136
$this->expectExceptionMessage($message);

src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ private function loadFromFile(ContainerBuilder $container, $file, $format)
308308
$loader = new YamlFileLoader($container, $locator);
309309
break;
310310
default:
311-
throw new \InvalidArgumentException(sprintf('Unsupported format: %s', $format));
311+
throw new \InvalidArgumentException(sprintf('Unsupported format: "%s"', $format));
312312
}
313313

314314
$loader->load($file.'.'.$format);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public static function createConnection(string $dsn, array $options = [])
134134
return CouchbaseBucketAdapter::createConnection($dsn, $options);
135135
}
136136

137-
throw new InvalidArgumentException(sprintf('Unsupported DSN: %s.', $dsn));
137+
throw new InvalidArgumentException(sprintf('Unsupported DSN: "%s".', $dsn));
138138
}
139139

140140
/**

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public static function createConnection($servers, array $options = [])
9292
if (\is_string($servers)) {
9393
$servers = [$servers];
9494
} elseif (!\is_array($servers)) {
95-
throw new InvalidArgumentException(sprintf('MemcachedAdapter::createClient() expects array or string as first argument, %s given.', \gettype($servers)));
95+
throw new InvalidArgumentException(sprintf('MemcachedAdapter::createClient() expects array or string as first argument, "%s" given.', \gettype($servers)));
9696
}
9797
if (!static::isSupported()) {
9898
throw new CacheException('Memcached >= 2.2.0 is required.');
@@ -110,7 +110,7 @@ public static function createConnection($servers, array $options = [])
110110
continue;
111111
}
112112
if (0 !== strpos($dsn, 'memcached:')) {
113-
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s does not start with "memcached:".', $dsn));
113+
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: "%s" does not start with "memcached:".', $dsn));
114114
}
115115
$params = preg_replace_callback('#^memcached:(//)?(?:([^@]*+)@)?#', function ($m) use (&$username, &$password) {
116116
if (!empty($m[2])) {
@@ -120,15 +120,15 @@ public static function createConnection($servers, array $options = [])
120120
return 'file:'.($m[1] ?? '');
121121
}, $dsn);
122122
if (false === $params = parse_url($params)) {
123-
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s.', $dsn));
123+
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: "%s".', $dsn));
124124
}
125125
$query = $hosts = [];
126126
if (isset($params['query'])) {
127127
parse_str($params['query'], $query);
128128

129129
if (isset($query['host'])) {
130130
if (!\is_array($hosts = $query['host'])) {
131-
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s.', $dsn));
131+
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: "%s".', $dsn));
132132
}
133133
foreach ($hosts as $host => $weight) {
134134
if (false === $port = strrpos($host, ':')) {
@@ -147,7 +147,7 @@ public static function createConnection($servers, array $options = [])
147147
}
148148
}
149149
if (!isset($params['host']) && !isset($params['path'])) {
150-
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s.', $dsn));
150+
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: "%s".', $dsn));
151151
}
152152
if (isset($params['path']) && preg_match('#/(\d+)$#', $params['path'], $m)) {
153153
$params['weight'] = $m[1];

0 commit comments

Comments
 (0)
0