1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Merge pull request #8895 from weirdan/replace-array-to-xml

Fixes https://github.com/vimeo/psalm/issues/8852
This commit is contained in:
Bruce Weirdan 2022-12-13 05:36:00 -04:00 committed by GitHub
commit 321d5fee62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -33,8 +33,8 @@
"fidry/cpu-core-counter": "^0.4.0",
"netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0",
"nikic/php-parser": "^4.13",
"openlss/lib-array2xml": "^1.0",
"sebastian/diff": "^4.0",
"spatie/array-to-xml": "^2.17.0",
"symfony/console": "^4.1.6 || ^5.0 || ^6.0",
"symfony/filesystem": "^5.4 || ^6.0",
"symfony/polyfill-php80": "^1.25"

View File

@ -2,10 +2,10 @@
namespace Psalm\Report;
use LSS\Array2XML;
use Psalm\Internal\Analyzer\DataFlowNodeData;
use Psalm\Internal\Analyzer\IssueData;
use Psalm\Report;
use Spatie\ArrayToXml\ArrayToXml;
use function array_map;
use function get_object_vars;
@ -14,8 +14,7 @@ final class XmlReport extends Report
{
public function create(): string
{
$xml = Array2XML::createXML(
'report',
$xml = (string) ArrayToXml::convert(
[
'item' => array_map(
static function (IssueData $issue_data): array {
@ -46,9 +45,14 @@ final class XmlReport extends Report
},
$this->issues_data
)
]
],
'report',
true,
'UTF-8',
'1.0',
['preserveWhiteSpace' => false, 'formatOutput' => true]
);
return $xml->saveXML();
return $xml;
}
}