|
18 | 18 | use function is_array; |
19 | 19 | use function is_dir; |
20 | 20 | use function is_writable; |
| 21 | +use function libxml_clear_errors; |
| 22 | +use function libxml_get_errors; |
| 23 | +use function libxml_use_internal_errors; |
21 | 24 | use function sprintf; |
22 | 25 | use function strlen; |
23 | 26 | use function substr; |
24 | 27 | use DateTimeImmutable; |
25 | 28 | use DOMDocument; |
| 29 | +use RuntimeException; |
26 | 30 | use SebastianBergmann\CodeCoverage\CodeCoverage; |
27 | 31 | use SebastianBergmann\CodeCoverage\Directory as DirectoryUtil; |
28 | 32 | use SebastianBergmann\CodeCoverage\Driver\PathExistsButIsNotDirectoryException; |
@@ -270,24 +274,24 @@ private function saveDocument(DOMDocument $document, string $name): void |
270 | 274 | $document->preserveWhiteSpace = false; |
271 | 275 | $this->initTargetDirectory(dirname($filename)); |
272 | 276 |
|
273 | | - $original = \libxml_use_internal_errors(true); |
| 277 | + $original = libxml_use_internal_errors(true); |
274 | 278 |
|
275 | 279 | /* @see https://bugs.php.net/bug.php?id=79191 */ |
276 | 280 | $xml = $document->saveXML(); |
277 | 281 |
|
278 | 282 | if ($xml === false) { |
279 | 283 | $message = 'Unable to generate the XML'; |
280 | 284 |
|
281 | | - foreach (\libxml_get_errors() as $error) { |
| 285 | + foreach (libxml_get_errors() as $error) { |
282 | 286 | $message .= "\n" . $error->message; |
283 | 287 | } |
284 | 288 |
|
285 | | - throw new \RuntimeException($message); |
| 289 | + throw new RuntimeException($message); |
286 | 290 | } |
287 | 291 |
|
288 | | - \libxml_clear_errors(); |
289 | | - \libxml_use_internal_errors($original); |
| 292 | + libxml_clear_errors(); |
| 293 | + libxml_use_internal_errors($original); |
290 | 294 |
|
291 | | - \file_put_contents($filename, $xml); |
| 295 | + file_put_contents($filename, $xml); |
292 | 296 | } |
293 | 297 | } |
0 commit comments