public static function to($type, $value, $argNum = 0, $pseudoTypes = [])
    {
        try {
            return lib\Type::to($type, $value, $pseudoTypes);
        } catch (\LogicException $exception) {
            $callerInfomation = self::getCallerInfomation();
            $errorMessage = $callerInfomation['function'] === '__set'
                ? sprintf(
                    'Value set to %s is not of the expected type',
                    $callerInfomation['class'] . '::' . $callerInfomation['args'][0]
                )
                : sprintf(
                    'Argument %d passed to %s is not of the expected type',
                    $argNum + 1,
                    $callerInfomation['class'] . '::' . $callerInfomation['function'] . '()'
                );
            if ($exception instanceof \DomainException) {
                throw new \DomainException($errorMessage, 0, $exception);
            } elseif ($exception instanceof \InvalidArgumentException) {
                throw new \InvalidArgumentException($errorMessage, 0, $exception);
            } else {
                throw $exception;
            }
        }
    }