public function setType($type)
    {
        if (empty($type)) {
            $this->type = null;
            return $this;
        }

        if (!is_string($type)) {
            throw new InvalidArgumentException(
                'Form property widget type must be a string'
            );
        }

        if ($this->propertyFactory()->isResolvable($type)) {
            $this->setPropertyType($type);
        }

        $this->type = $type;

        return $this;
    }