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
10 changes: 10 additions & 0 deletions src/TicketSwapErrorFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,16 @@ private static function trimPath(string $path) : string
public static function highlight(string $message, ?string $tip, ?string $identifier, bool $isDecorated) : string
{
if (!$isDecorated) {
if ($tip !== null) {
foreach (explode("\n", $tip) as $line) {
$message .= "\nTip: " . ltrim($line, ' •');
}
}

if ($identifier !== null) {
$message .= "\nIdentifier: " . $identifier;
}

return $message;
}

Expand Down
7 changes: 7 additions & 0 deletions tests/TicketSwapErrorFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,13 @@ public static function provideHighlight() : iterable
null,
false
];
yield [
"Parameter #1 \$currentWorkingDirectory of method Application\AnalyzeCommand: getFinder() expects string, string|false given.\nTip: you can do blabla.\nIdentifier: argument.type",
'Parameter #1 $currentWorkingDirectory of method Application\AnalyzeCommand: getFinder() expects string, string|false given.',
'you can do blabla.',
'argument.type',
false
];
yield [
"Parameter #1 <fg=green>\$currentWorkingDirectory</> of method <fg=yellow>Application\AnalyzeCommand</>: <fg=blue>getFinder()</> expects <fg=magenta>string</>, <fg=magenta>string</>|<fg=magenta>false</> given.\n💡 <fg=blue>Tip: you can do blabla.</>\n🔖 <fg=blue>argument.type</>",
'Parameter #1 $currentWorkingDirectory of method Application\AnalyzeCommand: getFinder() expects string, string|false given.',
Expand Down