Skip to content

Commit dbe8ded

Browse files
authored
Detect FQCN with leading slash (#23)
1 parent d4e89d4 commit dbe8ded

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
@@ -210,7 +210,7 @@ public static function highlight(string $message, ?string $tip, ?string $identif
210210

211211
// Full Qualified Class Names
212212
$message = (string) preg_replace(
213-
"/([A-Z0-9]{1}[A-Za-z0-9_\-]+[\\\]+[A-Z0-9]{1}[A-Za-z0-9_\-\\\]+)/",
213+
"/([\\\]?[A-Z0-9]{1}[A-Za-z0-9_\-]+[\\\]+[A-Z0-9]{1}[A-Za-z0-9_\-\\\]+)/",
214214
'<fg=yellow>$1</>',
215215
$message,
216216
);

tests/TicketSwapErrorFormatterTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,13 @@ public static function provideHighlight() : iterable
210210
null,
211211
true
212212
];
213+
yield [
214+
"Array has 3 duplicate keys with value '<fg=yellow>App\Activity</>' (<fg=yellow>\App\Activity</>::class).",
215+
"Array has 3 duplicate keys with value 'App\Activity' (\App\Activity::class).",
216+
null,
217+
null,
218+
true
219+
];
213220
}
214221

215222
/**

0 commit comments

Comments
 (0)