diff --git a/src/Psalm/Internal/Analyzer/IssueData.php b/src/Psalm/Internal/Analyzer/IssueData.php index c6a5b7ca2..5c83ff850 100644 --- a/src/Psalm/Internal/Analyzer/IssueData.php +++ b/src/Psalm/Internal/Analyzer/IssueData.php @@ -121,6 +121,7 @@ class IssueData * @param int $column_from * @param int $column_to * @param int $error_level + * @param int $shortcode */ public function __construct( $severity, @@ -138,6 +139,7 @@ class IssueData $snippet_to, $column_from, $column_to, + $shortcode = 0, $error_level = -1 ) { $this->severity = $severity; @@ -156,13 +158,6 @@ class IssueData $this->column_from = $column_from; $this->column_to = $column_to; $this->error_level = $error_level; - $this->link = $this->getLink(); - } - - private function getLink() : string - { - $class = 'Psalm\\Issue\\' . $this->type; - - return 'https://psalm.dev/' . \str_pad((string) $class::SHORTCODE, 3, "0", \STR_PAD_LEFT); + $this->link = 'https://psalm.dev/' . \str_pad((string) $shortcode, 3, "0", \STR_PAD_LEFT); } } diff --git a/src/Psalm/Issue/CodeIssue.php b/src/Psalm/Issue/CodeIssue.php index 03303fe72..c4abe543b 100644 --- a/src/Psalm/Issue/CodeIssue.php +++ b/src/Psalm/Issue/CodeIssue.php @@ -104,6 +104,7 @@ abstract class CodeIssue $fqcn_parts = explode('\\', get_called_class()); $issue_type = array_pop($fqcn_parts); + /** @psalm-suppress UndefinedConstant */ return new \Psalm\Internal\Analyzer\IssueData( $severity, $location->getLineNumber(), @@ -120,6 +121,7 @@ abstract class CodeIssue $snippet_bounds[1], $location->getColumn(), $location->getEndColumn(), + (int) static::SHORTCODE, (int) static::ERROR_LEVEL ); }