Skip to content

Commit b9f508f

Browse files
Merge branch '5.0'
* 5.0: Use PHP 7.2 minimum in tests run with github actions Fix exception messages containing exception messages
2 parents c9243e7 + 59dda56 commit b9f508f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Compiler/AbstractRecursivePass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ protected function getConstructor(Definition $definition, bool $required)
150150
throw new RuntimeException(sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class));
151151
}
152152
} catch (\ReflectionException $e) {
153-
throw new RuntimeException(sprintf('Invalid service "%s": '.lcfirst($e->getMessage()), $this->currentId));
153+
throw new RuntimeException(sprintf('Invalid service "%s": ', $this->currentId).lcfirst($e->getMessage()));
154154
}
155155
if (!$r = $r->getConstructor()) {
156156
if ($required) {
157157
throw new RuntimeException(sprintf('Invalid service "%s": class%s has no constructor.', $this->currentId, sprintf($class !== $this->currentId ? ' "%s"' : '', $class)));
158158
}
159159
} elseif (!$r->isPublic()) {
160-
throw new RuntimeException(sprintf('Invalid service "%s": %s must be public.', $this->currentId, sprintf($class !== $this->currentId ? 'constructor of class "%s"' : 'its constructor', $class)));
160+
throw new RuntimeException(sprintf('Invalid service "%s": ', $this->currentId).sprintf($class !== $this->currentId ? 'constructor of class "%s"' : 'its constructor', $class).' must be public.');
161161
}
162162

163163
return $r;

Loader/XmlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ private function parseFileToDOM(string $file): \DOMDocument
382382
try {
383383
$dom = XmlUtils::loadFile($file, [$this, 'validateSchema']);
384384
} catch (\InvalidArgumentException $e) {
385-
throw new InvalidArgumentException(sprintf('Unable to parse file "%s": "%s".', $file, $e->getMessage()), $e->getCode(), $e);
385+
throw new InvalidArgumentException(sprintf('Unable to parse file "%s": ', $file).$e->getMessage(), $e->getCode(), $e);
386386
}
387387

388388
$this->validateExtensions($dom, $file);

Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ protected function loadFile($file)
742742
try {
743743
$configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
744744
} catch (ParseException $e) {
745-
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML', $file).': '.$e->getMessage(), 0, $e);
745+
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: ', $file).$e->getMessage(), 0, $e);
746746
}
747747

748748
return $this->validate($configuration, $file);

0 commit comments

Comments
 (0)