@param string $type

doc: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/mysql-enums.html

@throws \InvalidArgumentException
190695
public function setProductType(string $type)
    {
        $types = [self::TYPE_DIGITAL, self::TYPE_PHYSICAL, self::TYPE_HYBRID];

        if (!in_array($type, $types)) {
            throw new \InvalidArgumentException('Invalid productType \'' . $type . '\'');
        }
        $this->productType = $type;
    }
548224
public function setType($type)
    {
        if (is_string($type)) {
            $type = ColumnType::createType($type);
        } elseif (!$type instanceof AbstractType) {
            throw new Exception\InvalidArgumentException(__METHOD__ . ' setType() accepts only AbstractType or string.');
        }
        $this->properties['type'] = $type;

        return $this;
    }
98160
public function setType($type)
    {
        $this->type = $type;
        if ($this->type == "xml") {
            $this->formatter = new XMLPDOResultFormatter();
        } elseif ($this->type == "plain") {
            $this->formatter = new PlainPDOResultFormatter();
        } else {
            throw new BuildException("Formatter '" . $this->type . "' not implemented");
        }
    }
360447
public static function create(string $type): \Menu\Type\TypeInterface
    {
        if (empty($type)) {
            throw new InvalidArgumentException('Type must be a non-empty string.');
        }

        $className = __NAMESPACE__ . '\\Types\\' . Inflector::camelize($type);
        if (!class_exists($className)) {
            throw new RuntimeException('Class [' . $className . '] does not exist.');
        }

        $interface = __NAMESPACE__ . '\\' . static::INTERFACE_CLASS;
        if (!in_array($interface, class_implements($className))) {
            throw new RuntimeException('Class [' . $className . '] must implement [' . $interface . '] interface.');
        }

        return new $className();
    }
85394
public function setType($type)
    {
        if (!is_string($type) || empty($type)) {
            throw MetadataException::invalidEntityType();
        }
        $this->type = $type;
        return $this;
    }
69647
public function setRequiredType($type)
    {
        if (!in_array($type, array('file', 'directory'))) {
            throw new \InvalidArgumentException("Input type must be either 'file' or 'directory'.");
        }

        if ($type === 'directory') {
            $this->setAllowDirectory(true);
        } else {
            $this->setAllowDirectory(false);
        }

        $this->requiredType = $type;

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

        if (!is_string($type)) {
            throw new InvalidArgumentException(
                'Property display type must be a string'
            );
        }

        $this->displayType = $type;

        return $this;
    }
1177067
protected function getInheritanceTypeString($type)
    {
        if ( ! isset(static::$inheritanceTypeMap[$type])) {
            throw new \InvalidArgumentException(sprintf('Invalid provided InheritanceType: %s', $type));
        }

        return static::$inheritanceTypeMap[$type];
    }
556125
public function of($type)
    {
        $type = strtolower($type);

        switch ($type) {

            case 'image':
            case 'jpg':
            case 'jpeg': {
                $this->type = 'jpg';
                break;
            }

            case 'audio':
            case 'mp3': {
                $this->type = 'mp3';
                break;
            }

            default: {
                if (in_array($type, ['png', 'pdf', 'doc', 'docx', 'odt'])) {
                    $this->type = $type;
                } else {
                    throw new InvalidArgumentException("Given type [$type] is incorrect.");
                }
            }
        }

        return $this;
    }
554722
public function setType($Type)
    {
        $validTypes = [self::TYPE_ONESHOT, self::TYPE_RECURRING];
        if (!in_array($Type, $validTypes)) {
            throw new \InvalidArgumentException(sprintf('Money out type "%s" not supported. Must be one of: "%s"', $Type, implode(',', $validTypes)));
        }
        $this->Type = $Type;

        return $this;
    }
1075408
public function setMimetype($type)
    {
        if ($type === null || $type === false) {
            $this->mimetype = null;

            return $this;
        }

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

        $this->mimetype = $type;

        return $this;
    }
218292
public function setType($type)
    {
        if ($type === null || $type === 'array') {
            $this->type = $type;

            return $this;
        }

        if ($this->isObjectNameValid($type) !== true) {
            throw new InvalidArgumentException('Parameter type is not valid.');
        }

        $this->type = $type;

        return $this;
    }
423138
public function setType($type)
    {
        if (!in_array($type, [Constants::GROUP_TYPE_AV_CHAT_ROOM, Constants::GROUP_TYPE_B_CHAT_ROOM, Constants::GROUP_TYPE_CHAT_ROOM, Constants::GROUP_TYPE_PRIVATE, Constants::GROUP_TYPE_PUBLIC])) {
            throw new InvalidArgumentException('Group type is incorrect.');
        }
        $this->setParameter('Type', $type);
        return $this;
    }
1057626
public function setInputType($type)
    {
        if (empty($type)) {
            $this->inputType = null;
            return $this;
        }

        if (!is_string($type)) {
            throw new InvalidArgumentException(
                'Property input type must be a string'
            );
        }

        $this->inputType = $type;

        return $this;
    }
552171
public function setType($type)
    {
        switch($type)
        {
            case self::YOUTUBE:
                return new Services\Youtube();
                break;

            case self::VIMEO:
                return new Services\Vimeo();
                break;

            default:
                throw new \InvalidArgumentException("$type is not a valid video site");
        }
    }
567230
public function type(string $classType)
    {
        $baseType = $this->class ? $this->class->getClassName() : TypedObject::class;
        if (!is_a($classType, $baseType, true)) {
            throw InvalidArgumentException::format(
                'Invalid call to %s: class type must be an subclass of %s, %s given',
                __METHOD__, $baseType, $classType
            );
        }

        /** @var TypedObject $classType */
        $this->class = $classType::definition();
    }
704153
public function resolve($type)
    {
        if (!is_string($type)) {
            throw new InvalidArgumentException(
                'Can not resolve class ident: type must be a string'
            );
        }

        // Normalize requested type with prefix / suffix, if applicable.
        $type = $this->prefix.$type.$this->suffix;

        $capitalizeNext = function(&$i) {
            $i = ucfirst($i);
        };

        $capitals = $this->capitals;
        foreach ($capitals as $cap) {
            $expl = explode($cap, $type);
            array_walk($expl, $capitalizeNext);
            $type = implode($cap, $expl);
        }

        $replacements = $this->replacements;
        foreach ($replacements as $rep => $target) {
            $type = str_replace($rep, $target, $type);
        }

        $class = '\\'.trim($type, '\\');

        return $class;
    }