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

Skip to content

Commit aab0e40

Browse files
committed
Fix quotes in exception messages
1 parent 1ae2da0 commit aab0e40

File tree

89 files changed

+129
-129
lines changed

Some content is hidden

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

89 files changed

+129
-129
lines changed

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

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

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

8686
return [

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/Twig/ErrorRenderer/TwigErrorRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class TwigErrorRenderer implements ErrorRendererInterface
3737
public function __construct(Environment $twig, HtmlErrorRenderer $fallbackErrorRenderer = null, $debug = false)
3838
{
3939
if (!\is_bool($debug) && !\is_callable($debug)) {
40-
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)));
40+
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)));
4141
}
4242

4343
$this->twig = $twig;

src/Symfony/Bridge/Twig/Extension/TranslationExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class TranslationExtension extends AbstractExtension
4242
public function __construct($translator = null, NodeVisitorInterface $translationNodeVisitor = null)
4343
{
4444
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
45-
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
45+
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
4646
}
4747
$this->translator = $translator;
4848
$this->translationNodeVisitor = $translationNodeVisitor;

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/ValidatorCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ValidatorCacheWarmer extends AbstractPhpFileCacheWarmer
3939
public function __construct($validatorBuilder, string $phpArrayFile)
4040
{
4141
if (!$validatorBuilder instanceof ValidatorBuilder && !$validatorBuilder instanceof ValidatorBuilderInterface) {
42-
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, ValidatorBuilder::class, \is_object($validatorBuilder) ? \get_class($validatorBuilder) : \gettype($validatorBuilder)));
42+
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, ValidatorBuilder::class, \is_object($validatorBuilder) ? \get_class($validatorBuilder) : \gettype($validatorBuilder)));
4343
}
4444
if (2 < \func_num_args() && func_get_arg(2) instanceof CacheItemPoolInterface) {
4545
@trigger_error(sprintf('The CacheItemPoolInterface $fallbackPool argument of "%s()" is deprecated since Symfony 4.2, you should not pass it anymore.', __METHOD__), E_USER_DEPRECATED);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class TranslationDebugCommand extends Command
5959
public function __construct($translator, TranslationReaderInterface $reader, ExtractorInterface $extractor, string $defaultTransPath = null, string $defaultViewsPath = null, array $transPaths = [], array $viewsPaths = [])
6060
{
6161
if (!$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
62-
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
62+
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
6363
}
6464
parent::__construct();
6565

src/Symfony/Bundle/FrameworkBundle/EventListener/ResolveControllerNameSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function resolveControllerName(...$args)
4949
public function __call(string $method, array $args)
5050
{
5151
if ('onKernelRequest' !== $method && 'onKernelRequest' !== strtolower($method)) {
52-
throw new \Error(sprintf('Error: Call to undefined method %s::%s().', static::class, $method));
52+
throw new \Error(sprintf('Error: Call to undefined method "%s::%s()".', static::class, $method));
5353
}
5454

5555
$event = $args[0];

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/Templating/Helper/TranslatorHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class TranslatorHelper extends Helper
3939
public function __construct($translator = null)
4040
{
4141
if (null !== $translator && !$translator instanceof LegacyTranslatorInterface && !$translator instanceof TranslatorInterface) {
42-
throw new \TypeError(sprintf('Argument 1 passed to %s() must be an instance of %s, %s given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
42+
throw new \TypeError(sprintf('Argument 1 passed to "%s()" must be an instance of "%s", "%s" given.', __METHOD__, TranslatorInterface::class, \is_object($translator) ? \get_class($translator) : \gettype($translator)));
4343
}
4444
$this->translator = $translator;
4545
}

src/Symfony/Component/Cache/CacheItem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function tag($tags): ItemInterface
130130
throw new InvalidArgumentException('Cache tag length must be greater than zero.');
131131
}
132132
if (false !== strpbrk($tag, self::RESERVED_CHARACTERS)) {
133-
throw new InvalidArgumentException(sprintf('Cache tag "%s" contains reserved characters %s.', $tag, self::RESERVED_CHARACTERS));
133+
throw new InvalidArgumentException(sprintf('Cache tag "%s" contains reserved characters "%s".', $tag, self::RESERVED_CHARACTERS));
134134
}
135135
$this->newMetadata[self::METADATA_TAGS][$tag] = $tag;
136136
}
@@ -174,7 +174,7 @@ public static function validateKey($key): string
174174
throw new InvalidArgumentException('Cache key length must be greater than zero.');
175175
}
176176
if (false !== strpbrk($key, self::RESERVED_CHARACTERS)) {
177-
throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters %s.', $key, self::RESERVED_CHARACTERS));
177+
throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters "%s".', $key, self::RESERVED_CHARACTERS));
178178
}
179179

180180
return $key;

src/Symfony/Component/Cache/Traits/MemcachedTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public static function createConnection($servers, array $options = [])
117117

118118
if (isset($query['host'])) {
119119
if (!\is_array($hosts = $query['host'])) {
120-
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: %s.', $dsn));
120+
throw new InvalidArgumentException(sprintf('Invalid Memcached DSN: "%s".', $dsn));
121121
}
122122
foreach ($hosts as $host => $weight) {
123123
if (false === $port = strrpos($host, ':')) {

src/Symfony/Component/Cache/Traits/PhpFilesTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ protected function doSave(array $values, $lifetime)
209209
try {
210210
$value = VarExporter::export($value, $isStaticValue);
211211
} catch (\Exception $e) {
212-
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable %s value.', $key, \is_object($value) ? \get_class($value) : 'array'), 0, $e);
212+
throw new InvalidArgumentException(sprintf('Cache key "%s" has non-serializable "%s" value.', $key, \is_object($value) ? \get_class($value) : 'array'), 0, $e);
213213
}
214214
} elseif (\is_string($value)) {
215215
// Wrap "N;" in a closure to not confuse it with an encoded `null`

src/Symfony/Component/Cache/Traits/RedisTrait.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,11 @@ public static function createConnection($dsn, array $options = [])
151151
}
152152

153153
if (!$hosts) {
154-
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: %s.', $dsn));
154+
throw new InvalidArgumentException(sprintf('Invalid Redis DSN: "%s".', $dsn));
155155
}
156156

157157
if (isset($params['redis_sentinel']) && !class_exists(\Predis\Client::class)) {
158-
throw new CacheException(sprintf('Redis Sentinel support requires the "predis/predis" package: %s.', $dsn));
158+
throw new CacheException(sprintf('Redis Sentinel support requires the "predis/predis" package: "%s".', $dsn));
159159
}
160160

161161
$params += $query + $options + self::$defaultConnectionOptions;
@@ -215,7 +215,7 @@ public static function createConnection($dsn, array $options = [])
215215
try {
216216
$redis = new $class($hosts, $params);
217217
} catch (\RedisClusterException $e) {
218-
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s.', $e->getMessage(), $dsn));
218+
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): "%s".', $e->getMessage(), $dsn));
219219
}
220220

221221
if (0 < $params['tcp_keepalive'] && \defined('Redis::OPT_TCP_KEEPALIVE')) {
@@ -230,7 +230,7 @@ public static function createConnection($dsn, array $options = [])
230230
try {
231231
$redis = new $class(null, $hosts, $params['timeout'], $params['read_timeout'], (bool) $params['persistent']);
232232
} catch (\RedisClusterException $e) {
233-
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): %s.', $e->getMessage(), $dsn));
233+
throw new InvalidArgumentException(sprintf('Redis connection failed (%s): "%s".', $e->getMessage(), $dsn));
234234
}
235235

236236
if (0 < $params['tcp_keepalive'] && \defined('Redis::OPT_TCP_KEEPALIVE')) {
@@ -250,7 +250,7 @@ public static function createConnection($dsn, array $options = [])
250250
if ($params['redis_cluster']) {
251251
$params['cluster'] = 'redis';
252252
if (isset($params['redis_sentinel'])) {
253-
throw new InvalidArgumentException(sprintf('Cannot use both "redis_cluster" and "redis_sentinel" at the same time: %s.', $dsn));
253+
throw new InvalidArgumentException(sprintf('Cannot use both "redis_cluster" and "redis_sentinel" at the same time: "%s".', $dsn));
254254
}
255255
} elseif (isset($params['redis_sentinel'])) {
256256
$params['replication'] = 'sentinel';

src/Symfony/Component/Config/Definition/Builder/TreeBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function root($name, $type = 'array', NodeBuilder $builder = null)
6161
public function getRootNode(): NodeDefinition
6262
{
6363
if (null === $this->root) {
64-
throw new \RuntimeException(sprintf('Calling %s() before creating the root node is not supported, migrate to the new constructor signature instead.', __METHOD__));
64+
throw new \RuntimeException(sprintf('Calling "%s()" before creating the root node is not supported, migrate to the new constructor signature instead.', __METHOD__));
6565
}
6666

6767
return $this->root;

src/Symfony/Component/DependencyInjection/Argument/ReferenceSetArgumentTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function setValues(array $values)
4545
{
4646
foreach ($values as $k => $v) {
4747
if (null !== $v && !$v instanceof Reference) {
48-
throw new InvalidArgumentException(sprintf('A %s must hold only Reference instances, "%s" given.', __CLASS__, \is_object($v) ? \get_class($v) : \gettype($v)));
48+
throw new InvalidArgumentException(sprintf('A "%s" must hold only Reference instances, "%s" given.', __CLASS__, \is_object($v) ? \get_class($v) : \gettype($v)));
4949
}
5050
}
5151

src/Symfony/Component/DependencyInjection/Compiler/AbstractRecursivePass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ private function getExpressionLanguage(): ExpressionLanguage
214214
$arg = $this->processValue(new Reference($id));
215215
$this->inExpression = false;
216216
if (!$arg instanceof Reference) {
217-
throw new RuntimeException(sprintf('"%s::processValue()" must return a Reference when processing an expression, %s returned for service("%s").', static::class, \is_object($arg) ? \get_class($arg) : \gettype($arg), $id));
217+
throw new RuntimeException(sprintf('"%s::processValue()" must return a Reference when processing an expression, "%s" returned for service("%s").', static::class, \is_object($arg) ? \get_class($arg) : \gettype($arg), $id));
218218
}
219219
$arg = sprintf('"%s"', $arg);
220220
}

src/Symfony/Component/DependencyInjection/Compiler/PriorityTaggedServiceTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public static function getDefaultIndex(ContainerBuilder $container, string $serv
125125
$defaultIndex = $rm->invoke(null);
126126

127127
if (!\is_string($defaultIndex)) {
128-
throw new InvalidArgumentException(sprintf('Either method "%s::%s()" should return a string (got %s) or tag "%s" on service "%s" is missing attribute "%s".', $class, $defaultIndexMethod, \gettype($defaultIndex), $tagName, $serviceId, $indexAttribute));
128+
throw new InvalidArgumentException(sprintf('Either method "%s::%s()" should return a string (got "%s") or tag "%s" on service "%s" is missing attribute "%s".', $class, $defaultIndexMethod, \gettype($defaultIndex), $tagName, $serviceId, $indexAttribute));
129129
}
130130

131131
return $defaultIndex;
@@ -154,7 +154,7 @@ public static function getDefaultPriority(ContainerBuilder $container, string $s
154154
$defaultPriority = $rm->invoke(null);
155155

156156
if (!\is_int($defaultPriority)) {
157-
throw new InvalidArgumentException(sprintf('Method "%s::%s()" should return an integer (got %s) or tag "%s" on service "%s" is missing attribute "priority".', $class, $defaultPriorityMethod, \gettype($defaultPriority), $tagName, $serviceId));
157+
throw new InvalidArgumentException(sprintf('Method "%s::%s()" should return an integer (got "%s") or tag "%s" on service "%s" is missing attribute "priority".', $class, $defaultPriorityMethod, \gettype($defaultPriority), $tagName, $serviceId));
158158
}
159159

160160
return $defaultPriority;

src/Symfony/Component/DependencyInjection/Compiler/ResolveBindingsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ protected function processValue($value, $isRoot = false)
134134
}
135135

136136
if (null !== $bindingValue && !$bindingValue instanceof Reference && !$bindingValue instanceof Definition && !$bindingValue instanceof TaggedIteratorArgument && !$bindingValue instanceof ServiceLocatorArgument) {
137-
throw new InvalidArgumentException(sprintf('Invalid value for binding key "%s" for service "%s": expected null, %s, %s, %s or ServiceLocatorArgument, "%s" given.', $key, $this->currentId, Reference::class, Definition::class, TaggedIteratorArgument::class, \gettype($bindingValue)));
137+
throw new InvalidArgumentException(sprintf('Invalid value for binding key "%s" for service "%s": expected null, "%s", "%s", "%s" or ServiceLocatorArgument, "%s" given.', $key, $this->currentId, Reference::class, Definition::class, TaggedIteratorArgument::class, \gettype($bindingValue)));
138138
}
139139
}
140140

src/Symfony/Component/DependencyInjection/EnvVarProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public function getEnv($prefix, $name, \Closure $getEnv)
244244
throw new RuntimeException(sprintf('Invalid URL in env var "%s".', $name));
245245
}
246246
if (!isset($parsedEnv['scheme'], $parsedEnv['host'])) {
247-
throw new RuntimeException(sprintf('Invalid URL env var "%s": schema and host expected, %s given.', $name, $env));
247+
throw new RuntimeException(sprintf('Invalid URL env var "%s": schema and host expected, "%s" given.', $name, $env));
248248
}
249249
$parsedEnv += [
250250
'port' => null,

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ private function processAnonymousServices(\DOMDocument $xml, string $file)
437437
// anonymous services "in the wild"
438438
if (false !== $nodes = $xpath->query('//container:services/container:service[not(@id)]')) {
439439
foreach ($nodes as $node) {
440-
throw new InvalidArgumentException(sprintf('Top-level services must have "id" attribute, none found in %s at line %d.', $file, $node->getLineNo()));
440+
throw new InvalidArgumentException(sprintf('Top-level services must have "id" attribute, none found in "%s" at line %d.', $file, $node->getLineNo()));
441441
}
442442
}
443443

0 commit comments

Comments
 (0)
0