Skip to content

Commit c024a6a

Browse files
committed
Merge branch '3.4' into 4.4
* 3.4: Add missing dots at the end of exception messages
2 parents 92fb32e + 88019d3 commit c024a6a

File tree

7 files changed

+18
-13
lines changed

7 files changed

+18
-13
lines changed

ContainerBuilder.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public function getExtension($name)
214214
return $this->extensionsByNs[$name];
215215
}
216216

217-
throw new LogicException(sprintf('Container extension "%s" is not registered', $name));
217+
throw new LogicException(sprintf('Container extension "%s" is not registered.', $name));
218218
}
219219

220220
/**
@@ -839,7 +839,7 @@ public function setAlias($alias, $id)
839839
$alias = (string) $alias;
840840

841841
if ('' === $alias || '\\' === $alias[-1] || \strlen($alias) !== strcspn($alias, "\0\r\n'")) {
842-
throw new InvalidArgumentException(sprintf('Invalid alias id: "%s"', $alias));
842+
throw new InvalidArgumentException(sprintf('Invalid alias id: "%s".', $alias));
843843
}
844844

845845
if (\is_string($id)) {
@@ -989,13 +989,18 @@ public function getDefinitions()
989989
public function setDefinition($id, Definition $definition)
990990
{
991991
if ($this->isCompiled()) {
992-
throw new BadMethodCallException('Adding definition to a compiled container is not allowed');
992+
throw new BadMethodCallException('Adding definition to a compiled container is not allowed.');
993993
}
994994

995995
$id = (string) $id;
996996

997+
<<<<<<< HEAD
997998
if ('' === $id || '\\' === $id[-1] || \strlen($id) !== strcspn($id, "\0\r\n'")) {
998999
throw new InvalidArgumentException(sprintf('Invalid service id: "%s"', $id));
1000+
=======
1001+
if ('' === $id || '\\' === substr($id, -1) || \strlen($id) !== strcspn($id, "\0\r\n'")) {
1002+
throw new InvalidArgumentException(sprintf('Invalid service id: "%s".', $id));
1003+
>>>>>>> 3.4
9991004
}
10001005

10011006
unset($this->aliasDefinitions[$id], $this->removedIds[$id]);
@@ -1120,7 +1125,7 @@ private function createService(Definition $definition, array &$inlineServices, b
11201125
if (\is_array($factory)) {
11211126
$factory = [$this->doResolveServices($parameterBag->resolveValue($factory[0]), $inlineServices, $isConstructorArgument), $factory[1]];
11221127
} elseif (!\is_string($factory)) {
1123-
throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory', $id));
1128+
throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory.', $id));
11241129
}
11251130
}
11261131

Dumper/PhpDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ private function addNewInstance(Definition $definition, string $return = '', str
10261026

10271027
if (\is_array($callable)) {
10281028
if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $callable[1])) {
1029-
throw new RuntimeException(sprintf('Cannot dump definition because of invalid factory method (%s)', $callable[1] ?: 'n/a'));
1029+
throw new RuntimeException(sprintf('Cannot dump definition because of invalid factory method (%s).', $callable[1] ?: 'n/a'));
10301030
}
10311031

10321032
if ($callable[0] instanceof Reference
@@ -1761,7 +1761,7 @@ private function dumpLiteralClass(string $class): string
17611761
return sprintf('${($_ = %s) && false ?: "_"}', $class);
17621762
}
17631763
if (0 !== strpos($class, "'") || !preg_match('/^\'(?:\\\{2})?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(?:\\\{2}[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*\'$/', $class)) {
1764-
throw new RuntimeException(sprintf('Cannot dump definition because of invalid class name (%s)', $class ?: 'n/a'));
1764+
throw new RuntimeException(sprintf('Cannot dump definition because of invalid class name (%s).', $class ?: 'n/a'));
17651765
}
17661766

17671767
$class = substr(str_replace('\\\\', '\\', $class), 1, -1);

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 $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 ? sprintf('"%s"', implode('", "', $extensions)) : 'none'));
5252
}
5353

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

Loader/FileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ private function findClasses(string $namespace, string $pattern, array $excludeP
180180
$prefixLen = \strlen($resource->getPrefix());
181181

182182
if ($excludePrefix && 0 !== strpos($excludePrefix, $resource->getPrefix())) {
183-
throw new InvalidArgumentException(sprintf('Invalid "exclude" pattern when importing classes for "%s": make sure your "exclude" pattern (%s) is a subset of the "resource" pattern (%s)', $namespace, $excludePattern, $pattern));
183+
throw new InvalidArgumentException(sprintf('Invalid "exclude" pattern when importing classes for "%s": make sure your "exclude" pattern (%s) is a subset of the "resource" pattern (%s).', $namespace, $excludePattern, $pattern));
184184
}
185185
}
186186

Loader/XmlFileLoader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ private function parseFileToDOM(string $file): \DOMDocument
395395
try {
396396
$dom = XmlUtils::loadFile($file, [$this, 'validateSchema']);
397397
} catch (\InvalidArgumentException $e) {
398-
throw new InvalidArgumentException(sprintf('Unable to parse file "%s": %s', $file, $e->getMessage()), $e->getCode(), $e);
398+
throw new InvalidArgumentException(sprintf('Unable to parse file "%s": %s.', $file, $e->getMessage()), $e->getCode(), $e);
399399
}
400400

401401
$this->validateExtensions($dom, $file);
@@ -591,7 +591,7 @@ public function validateSchema(\DOMDocument $dom)
591591
$path = str_replace([$ns, str_replace('http://', 'https://', $ns)], str_replace('\\', '/', $extension->getXsdValidationBasePath()).'/', $items[$i + 1]);
592592

593593
if (!is_file($path)) {
594-
throw new RuntimeException(sprintf('Extension "%s" references a non-existent XSD file "%s"', \get_class($extension), $path));
594+
throw new RuntimeException(sprintf('Extension "%s" references a non-existent XSD file "%s".', \get_class($extension), $path));
595595
}
596596

597597
$schemaLocations[$items[$i]] = $path;
@@ -678,7 +678,7 @@ private function validateExtensions(\DOMDocument $dom, string $file)
678678
// can it be handled by an extension?
679679
if (!$this->container->hasExtension($node->namespaceURI)) {
680680
$extensionNamespaces = array_filter(array_map(function (ExtensionInterface $ext) { return $ext->getNamespace(); }, $this->container->getExtensions()));
681-
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'));
681+
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'));
682682
}
683683
}
684684
}

Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ private function validate($content, string $file): ?array
718718

719719
if (!$this->container->hasExtension($namespace)) {
720720
$extensionNamespaces = array_filter(array_map(function (ExtensionInterface $ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
721-
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', $namespace, $file, $namespace, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none'));
721+
throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s.', $namespace, $file, $namespace, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none'));
722722
}
723723
}
724724

0 commit comments

Comments
 (0)