function Fqsen::__construct
Same name in this branch
- 11.1.x vendor/phpdocumentor/reflection-docblock/src/DocBlock/Tags/Reference/Fqsen.php \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen::__construct()
Initializes the object.
Throws
InvalidArgumentException when $fqsen is not matching the format.
File
-
vendor/
phpdocumentor/ reflection-common/ src/ Fqsen.php, line 45
Class
- Fqsen
- Value Object for Fqsen.
Namespace
phpDocumentor\ReflectionCode
public function __construct(string $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(sprintf('"%s" is not a valid Fqsen.', $fqsen));
}
$this->fqsen = $fqsen;
if (isset($matches[2])) {
$this->name = $matches[2];
}
else {
$matches = explode('\\', $fqsen);
$name = end($matches);
assert(is_string($name));
$this->name = trim($name, '()');
}
}