Skip to content

Commit 88019d3

Browse files
committed
Add missing dots at the end of exception messages
1 parent b06b368 commit 88019d3

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

ContainerBuilder.php

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

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

219219
/**
@@ -866,7 +866,7 @@ public function setAlias($alias, $id)
866866
$alias = $this->normalizeId($alias);
867867

868868
if ('' === $alias || '\\' === substr($alias, -1) || \strlen($alias) !== strcspn($alias, "\0\r\n'")) {
869-
throw new InvalidArgumentException(sprintf('Invalid alias id: "%s"', $alias));
869+
throw new InvalidArgumentException(sprintf('Invalid alias id: "%s".', $alias));
870870
}
871871

872872
if (\is_string($id)) {
@@ -1017,13 +1017,13 @@ public function getDefinitions()
10171017
public function setDefinition($id, Definition $definition)
10181018
{
10191019
if ($this->isCompiled()) {
1020-
throw new BadMethodCallException('Adding definition to a compiled container is not allowed');
1020+
throw new BadMethodCallException('Adding definition to a compiled container is not allowed.');
10211021
}
10221022

10231023
$id = $this->normalizeId($id);
10241024

10251025
if ('' === $id || '\\' === substr($id, -1) || \strlen($id) !== strcspn($id, "\0\r\n'")) {
1026-
throw new InvalidArgumentException(sprintf('Invalid service id: "%s"', $id));
1026+
throw new InvalidArgumentException(sprintf('Invalid service id: "%s".', $id));
10271027
}
10281028

10291029
unset($this->aliasDefinitions[$id], $this->removedIds[$id]);
@@ -1152,7 +1152,7 @@ private function createService(Definition $definition, array &$inlineServices, $
11521152
if (\is_array($factory)) {
11531153
$factory = [$this->doResolveServices($parameterBag->resolveValue($factory[0]), $inlineServices, $isConstructorArgument), $factory[1]];
11541154
} elseif (!\is_string($factory)) {
1155-
throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory', $id));
1155+
throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory.', $id));
11561156
}
11571157
}
11581158

Dumper/PhpDumper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ private function addNewInstance(Definition $definition, $return, $instantiation,
895895
$callable = $definition->getFactory();
896896
if (\is_array($callable)) {
897897
if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $callable[1])) {
898-
throw new RuntimeException(sprintf('Cannot dump definition because of invalid factory method (%s)', $callable[1] ?: 'n/a'));
898+
throw new RuntimeException(sprintf('Cannot dump definition because of invalid factory method (%s).', $callable[1] ?: 'n/a'));
899899
}
900900

901901
if ($callable[0] instanceof Reference
@@ -1701,7 +1701,7 @@ private function dumpValue($value, $interpolate = true)
17011701

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

17071707
$class = $this->dumpValue($factory[0]);
@@ -1722,7 +1722,7 @@ private function dumpValue($value, $interpolate = true)
17221722
}
17231723
}
17241724

1725-
throw new RuntimeException('Cannot dump definition because of invalid factory');
1725+
throw new RuntimeException('Cannot dump definition because of invalid factory.');
17261726
}
17271727

17281728
$class = $value->getClass();
@@ -1785,7 +1785,7 @@ private function dumpLiteralClass($class)
17851785
return sprintf('${($_ = %s) && false ?: "_"}', $class);
17861786
}
17871787
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)) {
1788-
throw new RuntimeException(sprintf('Cannot dump definition because of invalid class name (%s)', $class ?: 'n/a'));
1788+
throw new RuntimeException(sprintf('Cannot dump definition because of invalid class name (%s).', $class ?: 'n/a'));
17891789
}
17901790

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

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

Loader/FileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private function findClasses($namespace, $pattern, $excludePattern)
129129
$prefixLen = \strlen($resource->getPrefix());
130130

131131
if ($excludePrefix && 0 !== strpos($excludePrefix, $resource->getPrefix())) {
132-
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));
132+
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));
133133
}
134134
}
135135

Loader/XmlFileLoader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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);
@@ -577,7 +577,7 @@ public function validateSchema(\DOMDocument $dom)
577577
$path = str_replace([$ns, str_replace('http://', 'https://', $ns)], str_replace('\\', '/', $extension->getXsdValidationBasePath()).'/', $items[$i + 1]);
578578

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

583583
$schemaLocations[$items[$i]] = $path;
@@ -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
}

Loader/YamlFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ protected function loadFile($file)
660660
try {
661661
$configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
662662
} catch (ParseException $e) {
663-
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: %s', $file, $e->getMessage()), 0, $e);
663+
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: %s.', $file, $e->getMessage()), 0, $e);
664664
} finally {
665665
restore_error_handler();
666666
}
@@ -695,7 +695,7 @@ private function validate($content, $file)
695695

696696
if (!$this->container->hasExtension($namespace)) {
697697
$extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getAlias(); }, $this->container->getExtensions()));
698-
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'));
698+
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'));
699699
}
700700
}
701701

Tests/Loader/FileLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public function testRegisterClassesWithIncompatibleExclude($resourcePattern, $ex
219219
);
220220
} catch (InvalidArgumentException $e) {
221221
$this->assertEquals(
222-
sprintf('Invalid "exclude" pattern when importing classes for "Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\": make sure your "exclude" pattern (%s) is a subset of the "resource" pattern (%s)', $excludePattern, $resourcePattern),
222+
sprintf('Invalid "exclude" pattern when importing classes for "Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\": make sure your "exclude" pattern (%s) is a subset of the "resource" pattern (%s).', $excludePattern, $resourcePattern),
223223
$e->getMessage()
224224
);
225225
}

0 commit comments

Comments
 (0)