diff --git a/src/TicketSwapErrorFormatter.php b/src/TicketSwapErrorFormatter.php index ca502c7..37cc849 100644 --- a/src/TicketSwapErrorFormatter.php +++ b/src/TicketSwapErrorFormatter.php @@ -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; } diff --git a/tests/TicketSwapErrorFormatterTest.php b/tests/TicketSwapErrorFormatterTest.php index 08a4aa3..cd9321c 100644 --- a/tests/TicketSwapErrorFormatterTest.php +++ b/tests/TicketSwapErrorFormatterTest.php @@ -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 \$currentWorkingDirectory of method Application\AnalyzeCommand: getFinder() expects string, string|false given.\nšŸ’” Tip: you can do blabla.\nšŸ”– argument.type", 'Parameter #1 $currentWorkingDirectory of method Application\AnalyzeCommand: getFinder() expects string, string|false given.',