Skip to content

Commit

Permalink
Use new IssueBuffer constants
Browse files Browse the repository at this point in the history
  • Loading branch information
alies-dev committed May 31, 2023
1 parent 174cd5c commit 67648ac
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
10 changes: 5 additions & 5 deletions src/Psalm/Internal/LanguageServer/LanguageServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -728,10 +728,10 @@ function (IssueData $issue_data): Diagnostic {
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;
Expand Down Expand Up @@ -788,7 +788,7 @@ function (IssueData $issue_data): Diagnostic {
);

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 */
Expand All @@ -797,7 +797,7 @@ function (IssueData $issue_data): Diagnostic {
} 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']--;
}
Expand All @@ -806,7 +806,7 @@ function (IssueData $issue_data): Diagnostic {
}, $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;
Expand Down
4 changes: 2 additions & 2 deletions src/Psalm/IssueBuffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -598,13 +598,13 @@ public static function finish(
);

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']--;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function __construct(
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;
Expand Down
3 changes: 2 additions & 1 deletion src/Psalm/Report/CompactReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -31,7 +32,7 @@ public function create(): string

$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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Psalm/Report/JunitReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public function create(): string
$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;
Expand Down

0 comments on commit 67648ac

Please sign in to comment.