1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-15 02:47:02 +01:00
psalm/src/Psalm/Report/JsonSummaryReport.php
2020-02-16 18:24:40 -05:00

33 lines
710 B
PHP

<?php
namespace Psalm\Report;
use function json_encode;
use Psalm\Report;
class JsonSummaryReport extends Report
{
/**
* {@inheritdoc}
*/
public function create(): string
{
$type_counts = [];
foreach ($this->issues_data as $issue_data) {
$type = $issue_data->type;
if (!isset($type_counts[$type])) {
$type_counts[$type] = 0;
}
++$type_counts[$type];
}
return json_encode([
'issue_counts' => $type_counts,
'mixed_expression_count' => $this->mixed_expression_count,
'total_expression_count' => $this->total_expression_count,
]) . "\n";
}
}