Skip to content

Commit 4eedbb1

Browse files
committed
TypeHelper: fixed regexp
1 parent b032783 commit 4eedbb1

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

SlevomatCodingStandard/Helpers/TypeHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class TypeHelper
1515
public static function isTypeName(string $typeName): bool
1616
{
1717
$matches = [];
18-
$result = preg_match('~^(\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$~', $typeName, $matches);
18+
$result = preg_match('~^\\\\?([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)(\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*$~', $typeName, $matches);
1919
if ($result === false) {
2020
// @codeCoverageIgnoreStart
2121
throw new \Exception('PREG error ' . preg_last_error());

tests/Helpers/TypeHelperTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public function dataNotValidTypeNames(): array
4545
['Foo\\'],
4646
['Foo[]'],
4747
['[]'],
48+
['\Dogma\Math\Range\RangeSet<T>'],
4849
];
4950
}
5051

0 commit comments

Comments
 (0)