diff --git a/README.md b/README.md index 52b12bc..68a80c8 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ # ReflectionCommon +[![Build Status](https://travis-ci.org/phpDocumentor/ReflectionCommon.svg?branch=master)](https://travis-ci.org/phpDocumentor/ReflectionCommon) diff --git a/src/Fqsen.php b/src/Fqsen.php index c7be3f1..ce88d03 100644 --- a/src/Fqsen.php +++ b/src/Fqsen.php @@ -38,7 +38,11 @@ final class Fqsen public function __construct($fqsen) { $matches = array(); - $result = preg_match('/^\\\\([\\w_\\\\]*)(?:[:]{2}\\$?([\\w_]+))?(?:\\(\\))?$/', $fqsen, $matches); + $result = preg_match( + '/^\\\\([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff\\\\]*)?(?:[:]{2}\\$?([a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*))?(?:\\(\\))?$/', + $fqsen, + $matches + ); if ($result === 0) { throw new \InvalidArgumentException( diff --git a/tests/unit/FqsenTest.php b/tests/unit/FqsenTest.php index 38c7680..aa1065d 100644 --- a/tests/unit/FqsenTest.php +++ b/tests/unit/FqsenTest.php @@ -43,6 +43,7 @@ public function validFqsenProvider() ['\My\Space\MY_CONSTANT2', 'MY_CONSTANT2'], ['\My\Space\MyClass', 'MyClass'], ['\My\Space\MyInterface', 'MyInterface'], + ['\My\Space\Option«T»', 'Option«T»'], ['\My\Space\MyTrait', 'MyTrait'], ['\My\Space\MyClass::myMethod()', 'myMethod'], ['\My\Space\MyClass::$my_property', 'my_property'], @@ -72,6 +73,7 @@ public function invalidFqsenProvider() ['\My\*'], ['\My\Space\.()'], ['My\Space'], + ['1_function()'] ]; }