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:
parent
cc77910338
commit
a237ba307c
@ -121,6 +121,7 @@ class IssueData
|
|||||||
* @param int $column_from
|
* @param int $column_from
|
||||||
* @param int $column_to
|
* @param int $column_to
|
||||||
* @param int $error_level
|
* @param int $error_level
|
||||||
|
* @param int $shortcode
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
$severity,
|
$severity,
|
||||||
@ -138,6 +139,7 @@ class IssueData
|
|||||||
$snippet_to,
|
$snippet_to,
|
||||||
$column_from,
|
$column_from,
|
||||||
$column_to,
|
$column_to,
|
||||||
|
$shortcode = 0,
|
||||||
$error_level = -1
|
$error_level = -1
|
||||||
) {
|
) {
|
||||||
$this->severity = $severity;
|
$this->severity = $severity;
|
||||||
@ -156,13 +158,6 @@ class IssueData
|
|||||||
$this->column_from = $column_from;
|
$this->column_from = $column_from;
|
||||||
$this->column_to = $column_to;
|
$this->column_to = $column_to;
|
||||||
$this->error_level = $error_level;
|
$this->error_level = $error_level;
|
||||||
$this->link = $this->getLink();
|
$this->link = 'https://psalm.dev/' . \str_pad((string) $shortcode, 3, "0", \STR_PAD_LEFT);
|
||||||
}
|
|
||||||
|
|
||||||
private function getLink() : string
|
|
||||||
{
|
|
||||||
$class = 'Psalm\\Issue\\' . $this->type;
|
|
||||||
|
|
||||||
return 'https://psalm.dev/' . \str_pad((string) $class::SHORTCODE, 3, "0", \STR_PAD_LEFT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,7 @@ abstract class CodeIssue
|
|||||||
$fqcn_parts = explode('\\', get_called_class());
|
$fqcn_parts = explode('\\', get_called_class());
|
||||||
$issue_type = array_pop($fqcn_parts);
|
$issue_type = array_pop($fqcn_parts);
|
||||||
|
|
||||||
|
/** @psalm-suppress UndefinedConstant */
|
||||||
return new \Psalm\Internal\Analyzer\IssueData(
|
return new \Psalm\Internal\Analyzer\IssueData(
|
||||||
$severity,
|
$severity,
|
||||||
$location->getLineNumber(),
|
$location->getLineNumber(),
|
||||||
@ -120,6 +121,7 @@ abstract class CodeIssue
|
|||||||
$snippet_bounds[1],
|
$snippet_bounds[1],
|
||||||
$location->getColumn(),
|
$location->getColumn(),
|
||||||
$location->getEndColumn(),
|
$location->getEndColumn(),
|
||||||
|
(int) static::SHORTCODE,
|
||||||
(int) static::ERROR_LEVEL
|
(int) static::ERROR_LEVEL
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user