1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Improve count checks slightly

This commit is contained in:
Matthew Brown 2020-01-22 07:51:24 -05:00
parent 5139d61171
commit 947765c1c6
3 changed files with 3 additions and 3 deletions

View File

@ -200,7 +200,7 @@ class ErrorBaseline
*/
private static function countIssueTypesByFile(array $issues): array
{
if (0 === count($issues)) {
if ($issues === []) {
return [];
}
$groupedIssues = array_reduce(

View File

@ -621,7 +621,7 @@ class IssueBuffer
$total_expression_count = $mixed_counts[0] + $mixed_counts[1];
$mixed_expression_count = $mixed_counts[0];
$normalized_data = 0 === count(self::$issues_data) ? [] : array_merge(...array_values(self::$issues_data));
$normalized_data = self::$issues_data === [] ? [] : array_merge(...array_values(self::$issues_data));
switch ($report_options->format) {
case Report::TYPE_COMPACT:

View File

@ -59,7 +59,7 @@ class Shepherd implements \Psalm\Plugin\Hook\AfterAnalysisInterface
unset($build_info['git']);
if ($build_info) {
$normalized_data = 0 === count($issues) ? [] : array_filter(
$normalized_data = $issues === [] ? [] : array_filter(
array_merge(...array_values($issues)),
/**
* @param array{severity: string} $i