1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-12 09:19:40 +01:00
psalm/src/Psalm/Report/JsonSummaryReport.php

32 lines
687 B
PHP
Raw Normal View History

2019-05-11 00:07:13 +02:00
<?php
namespace Psalm\Report;
2019-05-11 00:07:13 +02:00
use Psalm\Report;
2019-05-11 00:07:13 +02:00
class JsonSummaryReport extends Report
2019-05-11 00:07:13 +02:00
{
/**
* {{@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";
}
}