public function setType($key, $type)
    {
        $args = func_get_args();
        $type = array_pop($args);

        if (!($type instanceof Validator))
            $type = new Validator($type);

        if ($this->types->has($args))
        {
            $old_type = $this->types->get($args); 
            if ($old_type != $type)
                throw new \LogicException("Duplicate key: " . WF::str($args));
        }
        else
        {
            $args[] = $type;
            $this->types->set($args, null);
        }
        return $this;
    }