gen_stub: fix regexps with unintentional range due to - character placement (#12004)

This commit is contained in:
Ayesh Karunaratne 2023-08-20 20:20:56 +08:00 committed by GitHub
parent 807a05ee55
commit e6627ccb52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -272,7 +272,7 @@ class SimpleType {
}
$matches = [];
$isArray = preg_match("/array\s*<\s*([A-Za-z0-9_-|]+)?(\s*,\s*)?([A-Za-z0-9_-|]+)?\s*>/i", $typeString, $matches);
$isArray = preg_match("/array\s*<\s*([A-Za-z0-9_|-]+)?(\s*,\s*)?([A-Za-z0-9_|-]+)?\s*>/i", $typeString, $matches);
if ($isArray) {
if (empty($matches[1]) || empty($matches[3])) {
throw new Exception("array<> type hint must have both a key and a value");