Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"keywords": ["phpstan", "dev"],
"type": "phpstan-extension",
"require": {
"phpstan/phpstan": "^1.11",
"php": "^8.2"
"php": "^8.2",
"phpstan/phpstan": "^1.12.4"
},
"license": "MIT",
"autoload": {
Expand All @@ -19,5 +19,8 @@
"extension.neon"
]
}
},
"config": {
"sort-packages": true
}
}
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions src/TicketSwapErrorFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function formatErrors(AnalysisResult $analysisResult, Output $output) : i
$error->getTip()
) : null,
$error->getIdentifier(),
$output->isDecorated(),
),
'{identifier}' => $error->getIdentifier(),
'{links}' => implode([
Expand All @@ -84,13 +85,15 @@ public function formatErrors(AnalysisResult $analysisResult, Output $output) : i
$error->getFilePath(),
$this->relativePathHelper->getRelativePath($error->getFilePath()),
$this->editorUrl,
$output->isDecorated(),
),
$error->getTraitFilePath() !== null ? $this::link(
$this->linkFormat,
(int) $error->getLine(),
$error->getTraitFilePath(),
$this->relativePathHelper->getRelativePath($error->getTraitFilePath()),
$this->editorUrl,
$output->isDecorated(),
) : '',
]),
],
Expand Down Expand Up @@ -122,9 +125,10 @@ public static function link(
int $line,
string $absolutePath,
string $relativePath,
?string $editorUrl
?string $editorUrl,
bool $isDecorated,
) : string {
if ($editorUrl === null) {
if (!$isDecorated || $editorUrl === null) {
$format = self::LINK_FORMAT_WITHOUT_EDITOR;
}

Expand Down Expand Up @@ -161,8 +165,12 @@ private static function trimPath(string $path) : string
);
}

public static function highlight(string $message, ?string $tip, ?string $identifier) : string
public static function highlight(string $message, ?string $tip, ?string $identifier, bool $isDecorated) : string
{
if (!$isDecorated) {
return $message;
}

if (str_starts_with($message, 'Ignored error pattern')) {
return $message;
}
Expand Down