Skip to content

Commit 8f966b7

Browse files
committed
added unicode support for name validation
1 parent 4b55785 commit 8f966b7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Traits/ErrorTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
use function is_resource;
3838
use function is_string;
3939
use function key;
40+
use function preg_match;
4041
use function strpos;
4142

4243
/**
@@ -110,7 +111,7 @@ private static function assertValidName(string $name): void
110111
throw new InvalidArgumentException("A name cannot be an empty string");
111112
}
112113

113-
if (!ctype_alnum(str_replace('_', '', $name))) {
114+
if (!preg_match('/^\p{L}[\p{L}0-9_]*$/u', $name)) {
114115
throw new InvalidArgumentException('A name can only contain alphanumeric characters and underscores');
115116
}
116117

0 commit comments

Comments
 (0)