refactor: simplify regex to use Unicode properties \p{L} and \p{N

This commit is contained in:
vmadmax
2026-02-02 09:41:54 +01:00
parent a956de5446
commit 10a19f16ba

View File

@ -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;