Skip to content

Commit a3bc598

Browse files
committed
Symplify regex pattern
1 parent 87078c0 commit a3bc598

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/TicketSwapErrorFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public static function highlight(string $message, ?string $tip, ?string $identif
221221

222222
// Full Qualified Class Names
223223
$message = (string) preg_replace(
224-
"/([\\\]?[A-Z0-9]{1}[A-Za-z0-9_\-]+[\\\]+[A-Z0-9]{1}[A-Za-z0-9_\-\\\]+(?:::[A-Za-z0-9_]+)?)/",
224+
"/([\\\\]?[A-Z0-9]{1}[A-Za-z0-9_\\-]+[\\\\]+[A-Z0-9]{1}[A-Za-z0-9_\\-\\\\]+(?:::\\w+)?)/",
225225
'<fg=yellow>$1</>',
226226
$message,
227227
);
@@ -249,7 +249,7 @@ public static function highlight(string $message, ?string $tip, ?string $identif
249249

250250
// Class reference (e.g. ClassName::CONSTANT, ClassName::class)
251251
$message = (string) preg_replace(
252-
'/(?<=[\s])([A-Z][A-Za-z0-9_]+::[A-Za-z0-9_]+)(?=[\.\s\|><,\(\)\{\}]|$)/',
252+
'/(?<=[\s])([A-Z]\w+::\w+)(?=[\.\s\|><,\(\)\{\}]|$)/',
253253
'<fg=yellow>$1</>',
254254
$message,
255255
);

0 commit comments

Comments
 (0)