Skip to content

Commit f516f2b

Browse files
committed
Fix quotes in exception messages
1 parent 88019d3 commit f516f2b

16 files changed

+48
-48
lines changed

Compiler/ResolveBindingsPass.php

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

9292
if (null !== $bindingValue && !$bindingValue instanceof Reference && !$bindingValue instanceof Definition) {
93-
throw new InvalidArgumentException(sprintf('Invalid value for binding key "%s" for service "%s": expected null, an instance of %s or an instance of %s, %s given.', $key, $this->currentId, Reference::class, Definition::class, \gettype($bindingValue)));
93+
throw new InvalidArgumentException(sprintf('Invalid value for binding key "%s" for service "%s": expected null, an instance of "%s" or an instance of "%s", "%s" given.', $key, $this->currentId, Reference::class, Definition::class, \gettype($bindingValue)));
9494
}
9595
}
9696

Compiler/ResolveNamedArgumentsPass.php

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

6868
if (null !== $argument && !$argument instanceof Reference && !$argument instanceof Definition) {
69-
throw new InvalidArgumentException(sprintf('Invalid service "%s": the value of argument "%s" of method "%s()" must be null, an instance of %s or an instance of %s, %s given.', $this->currentId, $key, $class !== $this->currentId ? $class.'::'.$method : $method, Reference::class, Definition::class, \gettype($argument)));
69+
throw new InvalidArgumentException(sprintf('Invalid service "%s": the value of argument "%s" of method "%s()" must be null, an instance of "%s" or an instance of "%s", "%s" given.', $this->currentId, $key, $class !== $this->currentId ? $class.'::'.$method : $method, Reference::class, Definition::class, \gettype($argument)));
7070
}
7171

7272
$typeFound = false;

ContainerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,7 @@ public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs
14391439
$completed = true;
14401440
} else {
14411441
if (!\is_string($resolved) && !is_numeric($resolved)) {
1442-
throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type %s inside string value "%s".', $env, \gettype($resolved), $this->resolveEnvPlaceholders($value)));
1442+
throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type "%s" inside string value "%s".', $env, \gettype($resolved), $this->resolveEnvPlaceholders($value)));
14431443
}
14441444
$value = str_ireplace($placeholder, $resolved, $value);
14451445
}

Dumper/PhpDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,7 @@ private function addDefaultParametersMethod()
13061306

13071307
foreach ($this->container->getParameterBag()->all() as $key => $value) {
13081308
if ($key !== $resolvedKey = $this->container->resolveEnvPlaceholders($key)) {
1309-
throw new InvalidArgumentException(sprintf('Parameter name cannot use env parameters: %s.', $resolvedKey));
1309+
throw new InvalidArgumentException(sprintf('Parameter name cannot use env parameters: "%s".', $resolvedKey));
13101310
}
13111311
if ($key !== $lcKey = strtolower($key)) {
13121312
$normalizedParams[] = sprintf(' %s => %s,', $this->export($lcKey), $this->export($key));

EnvVarProcessor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function getEnv($prefix, $name, \Closure $getEnv)
5757
throw new RuntimeException(sprintf('Invalid file name: env var "%s" is non-scalar.', $name));
5858
}
5959
if (!file_exists($file)) {
60-
throw new RuntimeException(sprintf('Env "file:%s" not found: %s does not exist.', $name, $file));
60+
throw new RuntimeException(sprintf('Env "file:%s" not found: "%s" does not exist.', $name, $file));
6161
}
6262

6363
return file_get_contents($file);
@@ -82,7 +82,7 @@ public function getEnv($prefix, $name, \Closure $getEnv)
8282
}
8383

8484
if (!is_scalar($env)) {
85-
throw new RuntimeException(sprintf('Non-scalar env var "%s" cannot be cast to %s.', $name, $prefix));
85+
throw new RuntimeException(sprintf('Non-scalar env var "%s" cannot be cast to "%s".', $name, $prefix));
8686
}
8787

8888
if ('string' === $prefix) {
@@ -129,7 +129,7 @@ public function getEnv($prefix, $name, \Closure $getEnv)
129129
}
130130

131131
if (!\is_array($env)) {
132-
throw new RuntimeException(sprintf('Invalid JSON env var "%s": array expected, %s given.', $name, \gettype($env)));
132+
throw new RuntimeException(sprintf('Invalid JSON env var "%s": array expected, "%s" given.', $name, \gettype($env)));
133133
}
134134

135135
return $env;

Loader/Configurator/AbstractConfigurator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __call($method, $args)
3131
return \call_user_func_array([$this, 'set'.$method], $args);
3232
}
3333

34-
throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s().', static::class, $method));
34+
throw new \BadMethodCallException(sprintf('Call to undefined method "%s::%s()".', static::class, $method));
3535
}
3636

3737
/**

Loader/Configurator/ContainerConfigurator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ final public function extension($namespace, array $config)
4545
{
4646
if (!$this->container->hasExtension($namespace)) {
4747
$extensions = array_filter(array_map(function ($ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
48-
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s.', $namespace, $this->file, $namespace, $extensions ? sprintf('"%s"', implode('", "', $extensions)) : 'none'));
48+
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".', $namespace, $this->file, $namespace, $extensions ? implode('", "', $extensions) : 'none'));
4949
}
5050

5151
$this->container->loadFromExtension($namespace, static::processValue($config));

Loader/FileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ public function __construct(ContainerBuilder $container, FileLocatorInterface $l
4848
public function registerClasses(Definition $prototype, $namespace, $resource, $exclude = null)
4949
{
5050
if ('\\' !== substr($namespace, -1)) {
51-
throw new InvalidArgumentException(sprintf('Namespace prefix must end with a "\\": %s.', $namespace));
51+
throw new InvalidArgumentException(sprintf('Namespace prefix must end with a "\\": "%s".', $namespace));
5252
}
5353
if (!preg_match('/^(?:[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+\\\\)++$/', $namespace)) {
54-
throw new InvalidArgumentException(sprintf('Namespace is not a valid PSR-4 prefix: %s.', $namespace));
54+
throw new InvalidArgumentException(sprintf('Namespace is not a valid PSR-4 prefix: "%s".', $namespace));
5555
}
5656

5757
$classes = $this->findClasses($namespace, $resource, $exclude);

Loader/XmlFileLoader.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ private function getServiceDefaults(\DOMDocument $xml, $file)
170170

171171
foreach ($defaults['tags'] as $tag) {
172172
if ('' === $tag->getAttribute('name')) {
173-
throw new InvalidArgumentException(sprintf('The tag name for tag "<defaults>" in %s must be a non-empty string.', $file));
173+
throw new InvalidArgumentException(sprintf('The tag name for tag "<defaults>" in "%s" must be a non-empty string.', $file));
174174
}
175175
}
176176

@@ -336,7 +336,7 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults)
336336
}
337337

338338
if ('' === $tag->getAttribute('name')) {
339-
throw new InvalidArgumentException(sprintf('The tag name for service "%s" in %s must be a non-empty string.', (string) $service->getAttribute('id'), $file));
339+
throw new InvalidArgumentException(sprintf('The tag name for service "%s" in "%s" must be a non-empty string.', (string) $service->getAttribute('id'), $file));
340340
}
341341

342342
$definition->addTag($tag->getAttribute('name'), $parameters);
@@ -378,7 +378,7 @@ private function parseFileToDOM($file)
378378
try {
379379
$dom = XmlUtils::loadFile($file, [$this, 'validateSchema']);
380380
} catch (\InvalidArgumentException $e) {
381-
throw new InvalidArgumentException(sprintf('Unable to parse file "%s": %s.', $file, $e->getMessage()), $e->getCode(), $e);
381+
throw new InvalidArgumentException(sprintf('Unable to parse file "%s": "%s".', $file, $e->getMessage()), $e->getCode(), $e);
382382
}
383383

384384
$this->validateExtensions($dom, $file);
@@ -668,7 +668,7 @@ private function validateExtensions(\DOMDocument $dom, $file)
668668
// can it be handled by an extension?
669669
if (!$this->container->hasExtension($node->namespaceURI)) {
670670
$extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getNamespace(); }, $this->container->getExtensions()));
671-
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s.', $node->tagName, $file, $node->namespaceURI, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none'));
671+
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in "%s"). Looked for namespace "%s", found "%s".', $node->tagName, $file, $node->namespaceURI, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none'));
672672
}
673673
}
674674
}

0 commit comments

Comments
 (0)