1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 12:55:26 +01:00

Use new IssueBuffer constants

This commit is contained in:
Alies Lapatsin 2023-05-31 12:56:13 +02:00
parent 174cd5c0fe
commit 67648ac248
5 changed files with 12 additions and 11 deletions

View File

@ -728,10 +728,10 @@ class LanguageServer extends Dispatcher
new Position($end_line - 1, $end_column - 1),
);
switch ($severity) {
case Config::REPORT_INFO:
case IssueData::SEVERITY_INFO:
$diagnostic_severity = DiagnosticSeverity::WARNING;
break;
case Config::REPORT_ERROR:
case IssueData::SEVERITY_ERROR:
default:
$diagnostic_severity = DiagnosticSeverity::ERROR;
break;
@ -788,7 +788,7 @@ class LanguageServer extends Dispatcher
);
if ($position !== false) {
$issue_data->severity = Config::REPORT_INFO;
$issue_data->severity = IssueData::SEVERITY_INFO;
/** @psalm-suppress MixedArgument */
array_splice($issue_baseline[$file][$type]['s'], $position, 1);
/** @psalm-suppress MixedArrayAssignment, MixedOperand, MixedAssignment */
@ -797,7 +797,7 @@ class LanguageServer extends Dispatcher
} else {
/** @psalm-suppress MixedArrayAssignment */
$issue_baseline[$file][$type]['s'] = [];
$issue_data->severity = Config::REPORT_INFO;
$issue_data->severity = IssueData::SEVERITY_INFO;
/** @psalm-suppress MixedArrayAssignment, MixedOperand, MixedAssignment */
$issue_baseline[$file][$type]['o']--;
}
@ -806,7 +806,7 @@ class LanguageServer extends Dispatcher
}, $data[$file_path] ?? []),
function (IssueData $issue_data) {
//Hide Warnings
if ($issue_data->severity === Config::REPORT_INFO &&
if ($issue_data->severity === IssueData::SEVERITY_INFO &&
$this->client->clientConfiguration->hideWarnings
) {
return false;

View File

@ -598,13 +598,13 @@ final class IssueBuffer
);
if ($position !== false) {
$issue_data->severity = Config::REPORT_INFO;
$issue_data->severity = IssueData::SEVERITY_INFO;
array_splice($issue_baseline[$file][$type]['s'], $position, 1);
$issue_baseline[$file][$type]['o']--;
}
} else {
$issue_baseline[$file][$type]['s'] = [];
$issue_data->severity = Config::REPORT_INFO;
$issue_data->severity = IssueData::SEVERITY_INFO;
$issue_baseline[$file][$type]['o']--;
}
}

View File

@ -74,7 +74,7 @@ abstract class Report
if (!$report_options->show_info) {
$this->issues_data = array_filter(
$issues_data,
static fn(IssueData $issue_data): bool => $issue_data->severity !== Config::REPORT_INFO,
static fn(IssueData $issue_data): bool => $issue_data->severity !== IssueData::SEVERITY_INFO,
);
} else {
$this->issues_data = $issues_data;

View File

@ -3,6 +3,7 @@
namespace Psalm\Report;
use Psalm\Config;
use Psalm\Internal\Analyzer\IssueData;
use Psalm\Report;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Output\BufferedOutput;
@ -31,7 +32,7 @@ final class CompactReport extends Report
$output = [];
foreach ($this->issues_data as $i => $issue_data) {
if (!$this->show_info && $issue_data->severity === Config::REPORT_INFO) {
if (!$this->show_info && $issue_data->severity === IssueData::SEVERITY_INFO) {
continue;
}

View File

@ -27,8 +27,8 @@ final class JunitReport extends Report
$ndata = [];
foreach ($this->issues_data as $error) {
$is_error = $error->severity === Config::REPORT_ERROR;
$is_warning = $error->severity === Config::REPORT_INFO;
$is_error = $error->severity === IssueData::SEVERITY_ERROR;
$is_warning = $error->severity === IssueData::SEVERITY_INFO;
if (!$is_error && !$is_warning) {
continue;