Skip to content

Commit 5c90075

Browse files
committed
try new regex
1 parent 726686d commit 5c90075

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/Jms/YamlValidatorConverter.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,11 @@ private function loadValidatorType(array &$property, Type $type, $arrayized = fa
146146
// initial support for https://www.w3.org/TR/xsd-unicode-blocknames/
147147
// not supported by standard php regex implementation
148148
$regexPattern = strtr($item['value'], [
149-
'\p{IsBasicLatin}' => '[\x00-\x7F]',
150-
'\p{IsIsBasicLatin}' => '[\x{0000}-\x{007F}]',
151-
'\p{IsLatin-1Supplement}' => '[\x{0080}-\x{00FF}]',
152-
'\p{IsLatinExtended-A}' => '[\x{0100}-\x{024F}]',
153-
'\p{IsLatinExtended-B}' => '[\x{0180}-\x{024F}]',
149+
'\p{IsBasicLatin}' => '\p{Latin}',
150+
'\p{IsLatin-1Supplement}' => '\p{S}',
154151
]);
155152
$rules[] = [
156-
'Regex' => ['pattern' => "~{$regexPattern}~"],
153+
'Regex' => ['pattern' => "~{$regexPattern}~u"],
157154
];
158155
}
159156
break;

tests/Converter/Validator/Xsd2ValidatorTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function getRestrictionsValidations()
130130
[
131131
[
132132
'Regex' => [
133-
'pattern' => '~[\\x00-\\x7F][\\x{0080}-\\x{00FF}]~',
133+
'pattern' => '~\p{Latin}\p{S}~u',
134134
'groups' => ['xsd_rules'],
135135
],
136136
],
@@ -141,7 +141,7 @@ public function getRestrictionsValidations()
141141
[
142142
[
143143
'Regex' => [
144-
'pattern' => '~\\([0-9]{2}\\)\\s[0-9]{4}-[0-9]{4,5}~',
144+
'pattern' => '~\\([0-9]{2}\\)\\s[0-9]{4}-[0-9]{4,5}~u',
145145
'groups' => ['xsd_rules'],
146146
],
147147
],

0 commit comments

Comments
 (0)