mirror of
https://github.com/pestphp/pest.git
synced 2026-04-23 07:27:27 +02:00
refactor: simplify regex to use Unicode properties \p{L} and \p{N
This commit is contained in:
@ -110,8 +110,8 @@ final class TestCaseFactory
|
||||
$relativePath = (string) preg_replace('|%[a-fA-F0-9][a-fA-F0-9]|', '', $relativePath);
|
||||
// Remove escaped quote sequences (maintain namespace)
|
||||
$relativePath = str_replace(array_map(fn (string $quote): string => sprintf('\\%s', $quote), ['\'', '"']), '', $relativePath);
|
||||
// Limit to A-Z, a-z, 0-9, and Unicode letters.
|
||||
$relativePath = (string) preg_replace('/[^A-Za-z0-9\\\\\\p{L}]/u', '', $relativePath);
|
||||
// Limit to Unicode letters and numbers.
|
||||
$relativePath = (string) preg_replace('/[^\p{L}\p{N}\\\\]/u', '', $relativePath);
|
||||
|
||||
$classFQN = 'P\\'.$relativePath;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user