1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Fix #4252 - fix xml generation

This commit is contained in:
Matt Brown 2020-10-12 18:39:11 -04:00 committed by Daniil Gentili
parent d6c64eef25
commit 23d1571d2a
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
4 changed files with 15 additions and 9 deletions

View File

@ -119,7 +119,7 @@ class IssueData
* @var ?string
* @readonly
*/
private $dupe_key;
public $dupe_key;
/**
* @param ?list<ControlFlowNodeData|array{label: string, entry_path_type: string}> $taint_trace
@ -166,9 +166,4 @@ class IssueData
$this->taint_trace = $taint_trace;
$this->dupe_key = $dupe_key;
}
public function getDupeKey() : ?string
{
return $this->dupe_key;
}
}

View File

@ -412,7 +412,7 @@ class IssueBuffer
. '-' . $issue->file_name
. ':' . $issue->line_from
. ':' . $issue->column_from
. ' ' . $issue->getDupeKey();
. ' ' . $issue->dupe_key;
if (!self::alreadyEmitted($emitted_key)) {
self::$issues_data[$file_path][] = $issue;

View File

@ -13,6 +13,15 @@ class JsonReport extends Report
{
$options = $this->pretty ? Json::PRETTY : Json::DEFAULT;
return Json::encode(array_values($this->issues_data), $options) . "\n";
$issues_data = \array_map(
function ($issue_data): array {
$issue_data = (array) $issue_data;
unset($issue_data['dupe_key']);
return $issue_data;
},
$this->issues_data
);
return Json::encode(array_values($issues_data), $options) . "\n";
}
}

View File

@ -15,7 +15,9 @@ class XmlReport extends Report
[
'item' => array_map(
function (IssueData $issue_data): array {
return (array) $issue_data;
$issue_data = (array) $issue_data;
unset($issue_data['dupe_key']);
return $issue_data;
},
$this->issues_data
)