From 37f0cd6263a717f5894bb99d6c5f071bb2fd7a8f Mon Sep 17 00:00:00 2001 From: orklah Date: Sun, 6 Dec 2020 17:29:05 +0100 Subject: [PATCH] Don't add link if the issue doesn't have a shortcode (#4786) --- src/Psalm/Internal/Analyzer/IssueData.php | 2 +- src/Psalm/Report/ConsoleReport.php | 2 +- src/Psalm/Report/PhpStormReport.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/IssueData.php b/src/Psalm/Internal/Analyzer/IssueData.php index 9b2be54fa..6d377e3e1 100644 --- a/src/Psalm/Internal/Analyzer/IssueData.php +++ b/src/Psalm/Internal/Analyzer/IssueData.php @@ -162,7 +162,7 @@ class IssueData $this->column_to = $column_to; $this->shortcode = $shortcode; $this->error_level = $error_level; - $this->link = 'https://psalm.dev/' . \str_pad((string) $shortcode, 3, "0", \STR_PAD_LEFT); + $this->link = $shortcode ? 'https://psalm.dev/' . \str_pad((string) $shortcode, 3, "0", \STR_PAD_LEFT) : ''; $this->taint_trace = $taint_trace; $this->dupe_key = $dupe_key; } diff --git a/src/Psalm/Report/ConsoleReport.php b/src/Psalm/Report/ConsoleReport.php index 2656a5ef6..00faf44e4 100644 --- a/src/Psalm/Report/ConsoleReport.php +++ b/src/Psalm/Report/ConsoleReport.php @@ -30,7 +30,7 @@ class ConsoleReport extends Report $issue_string .= 'INFO'; } - $issue_reference = ' (see ' . $issue_data->link . ')'; + $issue_reference = $issue_data->link ? ' (see ' . $issue_data->link . ')' : ''; $issue_string .= ': ' . $issue_data->type . ' - ' . $issue_data->file_name . ':' . $issue_data->line_from . ':' . $issue_data->column_from diff --git a/src/Psalm/Report/PhpStormReport.php b/src/Psalm/Report/PhpStormReport.php index 4ef4c5d9e..cb7694dff 100644 --- a/src/Psalm/Report/PhpStormReport.php +++ b/src/Psalm/Report/PhpStormReport.php @@ -30,7 +30,7 @@ class PhpStormReport extends Report $issue_string .= 'INFO'; } - $issue_reference = ' (see ' . $issue_data->link . ')'; + $issue_reference = $issue_data->link ? ' (see ' . $issue_data->link . ')' : ''; $issue_string .= ': ' . $issue_data->type . "\nat " . $issue_data->file_path . ':' . $issue_data->line_from . ':' . $issue_data->column_from