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

Use simpler method for generating links

This commit is contained in:
Matthew Brown 2020-03-19 17:12:16 -04:00
parent cc77910338
commit a237ba307c
2 changed files with 5 additions and 8 deletions

View File

@ -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);
}
}

View File

@ -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
);
}