public static function detectType($type)
{
static $cache;
if (!isset($cache[$type])) {
$cache[$type] = 'string';
foreach (self::$typePatterns as $s => $val) {
if (preg_match("#^({$s})\$#i", $type)) {
return $cache[$type] = $val;
}
}
}
return $cache[$type];
}