Skip to content

Commit 1471308

Browse files
committed
Allow numbers in fqsen
1 parent e954007 commit 1471308

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Fqsen.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ final class Fqsen
3838
public function __construct($fqsen)
3939
{
4040
$matches = array();
41-
$result = preg_match('/^\\\\([A-Za-z_\\\\]+)(?:[:]{2}\\$?([a-zA-Z_]+))?(?:\\(\\))?$/', $fqsen, $matches);
41+
$result = preg_match('/^\\\\([\\w_\\\\]+)(?:[:]{2}\\$?([\\w_]+))?(?:\\(\\))?$/', $fqsen, $matches);
4242

4343
if ($result === 0) {
4444
throw new \InvalidArgumentException(

tests/unit/FqsenTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public function validFqsenProvider()
3939
['\My\Space', 'Space'],
4040
['\My\Space\myFunction()', 'myFunction'],
4141
['\My\Space\MY_CONSTANT', 'MY_CONSTANT'],
42+
['\My\Space\MY_CONSTANT2', 'MY_CONSTANT2'],
4243
['\My\Space\MyClass', 'MyClass'],
4344
['\My\Space\MyInterface', 'MyInterface'],
4445
['\My\Space\MyTrait', 'MyTrait'],

0 commit comments

Comments
 (0)