1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Trim issue snippet at time of comparison with baseline, not in IssueData constructor

This commit is contained in:
Barney Laurance 2021-06-27 10:33:09 +01:00
parent 097ccf16b4
commit 140cf01a91
2 changed files with 3 additions and 4 deletions

View File

@ -2,8 +2,6 @@
namespace Psalm\Internal\Analyzer;
use function trim;
class IssueData
{
/**
@ -156,7 +154,7 @@ class IssueData
$this->file_name = $file_name;
$this->file_path = $file_path;
$this->snippet = $snippet;
$this->selected_text = trim($selected_text);
$this->selected_text = $selected_text;
$this->from = $from;
$this->to = $to;
$this->snippet_from = $snippet_from;

View File

@ -48,6 +48,7 @@ use function sha1;
use function sprintf;
use function str_repeat;
use function str_replace;
use function trim;
use function usort;
use const DEBUG_BACKTRACE_IGNORE_ARGS;
@ -518,7 +519,7 @@ class IssueBuffer
if (isset($issue_baseline[$file][$type]) && $issue_baseline[$file][$type]['o'] > 0) {
if ($issue_baseline[$file][$type]['o'] === count($issue_baseline[$file][$type]['s'])) {
$position = array_search(
$issue_data->selected_text,
trim($issue_data->selected_text),
$issue_baseline[$file][$type]['s'],
true
);