private static function typeStringComponents(string $type_string)
{
// Check to see if we have template parameter types
$template_parameter_type_name_list = [];
$match = [];
if (preg_match('/' . self::type_regex . '/', $type_string, $match)) {
$type_string = $match[1];
// If we have a generic array symbol '[]', append that back
// on to the type string
if (isset($match[7])) {
// Figure out the dimensionality of the type array
$gmatch = [];
if (preg_match('/\\[[\\]\\[]*\\]/', $match[0], $gmatch)) {
$type_string .= $gmatch[0];
}
}
$template_parameter_type_name_list = !empty($match[3]) ? preg_split('/\\s*,\\s*/', $match[3]) : [];
}
// Determine if the type name is fully qualified
// (as specified by a leading backslash).
$is_fully_qualified = 0 === strpos($type_string, '\\');
$fq_class_name_elements = array_filter(explode('\\', $type_string));
$class_name = (string) array_pop($fq_class_name_elements);
$namespace = ($is_fully_qualified ? '\\' : '') . implode('\\', array_filter($fq_class_name_elements));
return new Tuple3($namespace, $class_name, $template_parameter_type_name_list);
}