public static function fromFullyQualifiedString(string $fully_qualified_string) : Type
{
assert(!empty($fully_qualified_string), "Type cannot be empty");
if (0 !== strpos($fully_qualified_string, '\\')) {
return self::fromInternalTypeName($fully_qualified_string);
}
$tuple = self::typeStringComponents($fully_qualified_string);
$namespace = $tuple->_0;
$type_name = $tuple->_1;
$template_parameter_type_name_list = $tuple->_2;
// Map the names of the types to actual types in the
// template parameter type list
$template_parameter_type_list = array_map(function (string $type_name) {
return Type::fromFullyQualifiedString($type_name)->asUnionType();
}, $template_parameter_type_name_list);
if (0 !== strpos($namespace, '\\')) {
$namespace = '\\' . $namespace;
}
assert(!empty($namespace) && !empty($type_name), "Type was not fully qualified");
return self::make($namespace, $type_name, $template_parameter_type_list);
}