Skip to content

Commit 59dda56

Browse files
Merge branch '4.4' into 5.0
* 4.4: Fix exception messages containing exception messages
2 parents 4b11819 + ef5bab9 commit 59dda56

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
@@ -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": ', $file).$e->getMessage(), $e->getCode(), $e);
399399
}
400400

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

Loader/YamlFileLoader.php

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

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

0 commit comments

Comments
 (0)