Skip to content

Commit c0172d5

Browse files
authored
Support highlighting of variable ending with a period (#19)
1 parent 1a1f996 commit c0172d5

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/TicketSwapErrorFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public static function highlight(string $message, ?string $tip, ?string $identif
224224

225225
// Variable
226226
$message = (string) preg_replace(
227-
"/(?<=[:]{2}|[\s\"\(])([.]{3})?(\\$[A-Za-z0-9_\\-]+)(?=[\s|\"|\)]|$)/",
227+
"/(?<=[:]{2}|[\s\"\(])([.]{3})?(\\$[A-Za-z0-9_\\-]+)(?=[\.|\s|\"|\)]|$)/",
228228
'<fg=green>$1$2</>',
229229
$message,
230230
);

tests/TicketSwapErrorFormatterTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,13 @@ public static function provideHighlight() : iterable
182182
null,
183183
true
184184
];
185+
yield [
186+
"Parameter #1 <fg=green>\$currentWorkingDirectory</>.",
187+
'Parameter #1 $currentWorkingDirectory.',
188+
null,
189+
null,
190+
true
191+
];
185192
yield [
186193
'Parameter #1 $currentWorkingDirectory of method Application\AnalyzeCommand: getFinder() expects string, string|false given.',
187194
'Parameter #1 $currentWorkingDirectory of method Application\AnalyzeCommand: getFinder() expects string, string|false given.',

0 commit comments

Comments
 (0)