Skip to content

Commit 587ba07

Browse files
committed
Merge branch '4.4' into 5.0
* 4.4: Fix quotes in exception messages Fix quotes in exception messages Fix quotes in exception messages
2 parents 31ac82b + 25e13ee commit 587ba07

18 files changed

+55
-55
lines changed

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

Compiler/AbstractRecursivePass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ private function getExpressionLanguage(): ExpressionLanguage
209209
$arg = $this->processValue(new Reference($id));
210210
$this->inExpression = false;
211211
if (!$arg instanceof Reference) {
212-
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));
212+
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));
213213
}
214214
$arg = sprintf('"%s"', $arg);
215215
}

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;

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, bool $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

Compiler/ResolveNamedArgumentsPass.php

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

7878
if (null !== $argument && !$argument instanceof Reference && !$argument instanceof Definition) {
79-
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)));
79+
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)));
8080
}
8181

8282
$typeFound = false;

ContainerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,7 @@ public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs
13871387
$completed = true;
13881388
} else {
13891389
if (!\is_string($resolved) && !is_numeric($resolved)) {
1390-
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)));
1390+
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)));
13911391
}
13921392
$value = str_ireplace($placeholder, $resolved, $value);
13931393
}

Dumper/PhpDumper.php

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

13771377
foreach ($this->container->getParameterBag()->all() as $key => $value) {
13781378
if ($key !== $resolvedKey = $this->container->resolveEnvPlaceholders($key)) {
1379-
throw new InvalidArgumentException(sprintf('Parameter name cannot use env parameters: %s.', $resolvedKey));
1379+
throw new InvalidArgumentException(sprintf('Parameter name cannot use env parameters: "%s".', $resolvedKey));
13801380
}
13811381
$export = $this->exportParameters([$value]);
13821382
$export = explode('0 => ', substr(rtrim($export, " ]\n"), 2, -1), 2);

EnvVarProcessor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public function getEnv(string $prefix, string $name, \Closure $getEnv)
184184
}
185185

186186
if (!is_scalar($env)) {
187-
throw new RuntimeException(sprintf('Non-scalar env var "%s" cannot be cast to %s.', $name, $prefix));
187+
throw new RuntimeException(sprintf('Non-scalar env var "%s" cannot be cast to "%s".', $name, $prefix));
188188
}
189189

190190
if ('string' === $prefix) {
@@ -231,7 +231,7 @@ public function getEnv(string $prefix, string $name, \Closure $getEnv)
231231
}
232232

233233
if (null !== $env && !\is_array($env)) {
234-
throw new RuntimeException(sprintf('Invalid JSON env var "%s": array or null expected, %s given.', $name, \gettype($env)));
234+
throw new RuntimeException(sprintf('Invalid JSON env var "%s": array or null expected, "%s" given.', $name, \gettype($env)));
235235
}
236236

237237
return $env;
@@ -244,7 +244,7 @@ public function getEnv(string $prefix, string $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,

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(string $method, array $args)
3131
return $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
@@ -48,7 +48,7 @@ final public function extension(string $namespace, array $config)
4848
{
4949
if (!$this->container->hasExtension($namespace)) {
5050
$extensions = array_filter(array_map(function (ExtensionInterface $ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
51-
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'));
51+
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'));
5252
}
5353

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

0 commit comments

Comments
 (0)