Skip to content

Commit a03887a

Browse files
authored
Symplify regex pattern (#35)
1 parent e51a956 commit a03887a

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

219219
// Full Qualified Class Names
220220
$message = (string) preg_replace(
221-
"/([\\\]?[A-Z0-9]{1}[A-Za-z0-9_\-]+[\\\]+[A-Z0-9]{1}[A-Za-z0-9_\-\\\]+(?:::[A-Za-z0-9_]+)?)/",
221+
"/([\\\\]?[A-Z0-9]{1}[A-Za-z0-9_\\-]+[\\\\]+[A-Z0-9]{1}[A-Za-z0-9_\\-\\\\]+(?:::\\w+)?)/",
222222
'<fg=yellow>$1</>',
223223
$message,
224224
);
@@ -246,7 +246,7 @@ public static function highlight(string $message, ?string $tip, ?string $identif
246246

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

0 commit comments

Comments
 (0)