public static function create($value) {
        Str::assert($value, 'value');

        if($value === 'true')  return true;
        if($value === 'false') return false;
        if($value === 'null')  return null;

        $unquoted = preg_replace('/^(?|\"(.*)\"|\\\'(.*)\\\'|\`(.*)\`)$/', '$1', $value);
        if (!is_numeric($unquoted))                   return $unquoted;
        if ((string) intval($unquoted) === $unquoted) return intval($unquoted);

        return floatval($unquoted);
    }
public static function create($value) {
        Str::assert($value, 'value');

        if($value === 'true')  return true;
        if($value === 'false') return false;
        if($value === 'null')  return null;

        $unquoted = preg_replace('/^(?|\"(.*)\"|\\\'(.*)\\\'|\`(.*)\`)$/', '$1', $value);
        if (!is_numeric($unquoted))                   return $unquoted;
        if ((string) intval($unquoted) === $unquoted) return intval($unquoted);

        return floatval($unquoted);
    }
public static function create ( $ value ) { Str :: assert ( $ value , 'value' ) ; if ( $ value === 'true' ) return true ; if ( $ value === 'false' ) return false ; if ( $ value === 'null' ) return null ; $ unquoted = preg_replace ( '/^(?|\"(.*)\"|\\\'(.*)\\\'|\`(.*)\`)$/' , '$1' , $ value ) ; if ( ! is_numeric ( $ unquoted ) ) return $ unquoted ; if ( ( string ) intval ( $ unquoted ) === $ unquoted ) return intval ( $ unquoted ) ; return floatval ( $ unquoted ) ; }
Infers the type of a given string

@param  string $value
@return string
@throws InvalidTypeException

@SuppressWarnings("PHPMD.StaticAccess")
Infers the type of a given string