Skip to content

Commit ef5bab9

Browse files
Merge branch '3.4' into 4.4
* 3.4: Fix exception messages containing exception messages
2 parents f93e4ba + 5e96f83 commit ef5bab9

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
@@ -153,14 +153,14 @@ protected function getConstructor(Definition $definition, $required)
153153
throw new RuntimeException(sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class));
154154
}
155155
} catch (\ReflectionException $e) {
156-
throw new RuntimeException(sprintf('Invalid service "%s": '.lcfirst($e->getMessage()), $this->currentId));
156+
throw new RuntimeException(sprintf('Invalid service "%s": ', $this->currentId).lcfirst($e->getMessage()));
157157
}
158158
if (!$r = $r->getConstructor()) {
159159
if ($required) {
160160
throw new RuntimeException(sprintf('Invalid service "%s": class%s has no constructor.', $this->currentId, sprintf($class !== $this->currentId ? ' "%s"' : '', $class)));
161161
}
162162
} elseif (!$r->isPublic()) {
163-
throw new RuntimeException(sprintf('Invalid service "%s": %s must be public.', $this->currentId, sprintf($class !== $this->currentId ? 'constructor of class "%s"' : 'its constructor', $class)));
163+
throw new RuntimeException(sprintf('Invalid service "%s": ', $this->currentId).sprintf($class !== $this->currentId ? 'constructor of class "%s"' : 'its constructor', $class).' must be public.');
164164
}
165165

166166
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
@@ -690,7 +690,7 @@ protected function loadFile($file)
690690
try {
691691
$configuration = $this->yamlParser->parseFile($file, Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS);
692692
} catch (ParseException $e) {
693-
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML', $file).': '.$e->getMessage(), 0, $e);
693+
throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML: ', $file).$e->getMessage(), 0, $e);
694694
}
695695

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

0 commit comments

Comments
 (0)