Skip to content

Commit

Permalink
Trim issue snippet at time of comparison with baseline, not in IssueD…
Browse files Browse the repository at this point in the history
…ata constructor
  • Loading branch information
bdsl committed Jun 27, 2021
1 parent 097ccf1 commit 5bdb6ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Analyzer/IssueData.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function __construct(
$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;
Expand Down
3 changes: 2 additions & 1 deletion src/Psalm/IssueBuffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
use function sprintf;
use function str_repeat;
use function str_replace;
use function trim;
use function usort;

use const DEBUG_BACKTRACE_IGNORE_ARGS;
Expand Down Expand Up @@ -518,7 +519,7 @@ function (IssueData $d1, IssueData $d2) : int {
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
);
Expand Down

0 comments on commit 5bdb6ce

Please sign in to comment.