Skip to content

Commit 40471d7

Browse files
committed
allow \ as root namespace
1 parent 1471308 commit 40471d7

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('/^\\\\([\\w_\\\\]+)(?:[:]{2}\\$?([\\w_]+))?(?:\\(\\))?$/', $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
@@ -36,6 +36,7 @@ public function testValidFormats($fqsen, $name)
3636
public function validFqsenProvider()
3737
{
3838
return [
39+
['\\', ''],
3940
['\My\Space', 'Space'],
4041
['\My\Space\myFunction()', 'myFunction'],
4142
['\My\Space\MY_CONSTANT', 'MY_CONSTANT'],

0 commit comments

Comments
 (0)