Validate a use type.

@param int $type The type to validate.

@return bool True if the type is valid.
199354
private function validateType(int $type): bool
    {
        return $type === Node\Stmt\Use_::TYPE_NORMAL || $type === Node\Stmt\Use_::TYPE_UNKNOWN;
    }
491816
protected function validatePropertyType(string $property, string $type) : bool
    {
        list($type, $arg) = $this->parseType($type);

        switch ($type) {
            case 'any':
            case 'notnull':
            case 'isset':
            case 'set':
                return true;
            case 'string':
                return is_string($this->{$property});
            case 'email':
                return filter_var($this->{$property}, FILTER_VALIDATE_EMAIL) !== false;
            case 'url':
                return filter_var($this->{$property}, FILTER_VALIDATE_URL) !== false;
            case 'int':
                return is_int($this->{$property});
            case 'bool':
            case 'boolean':
                return is_bool($this->{$property});
            case 'array':
                return is_array($this->{$property});
            case 'null':
                return $this->{$property} === null;
            case 'is_a':
                return is_a($this->{$property}, $arg, true);
            case 'is':
                return is_a($this->{$property}, $arg);
            case 'instanceof':
                return $this->{$property} instanceof $arg;
            default:
                throw new \InvalidArgumentException("{$type} is not a recognised type");
        }
    }
86403
protected function _validateLoaderType($type)
    {
        $type = strtolower($type);
        if (!in_array($type, $this->_loaderTypes)) {
            $types = implode(', ', $this->_loaderTypes);

            throw new Zend_Http_UserAgent_Exception(sprintf(
                'Expected one of "%s" for plugin loader type; received "%s"',
                $types,
                (string) $type
            ));
        }
        return $type;
    }
106893
public function has($type)
    {
        if (!isset($this->checkers[$type])) {
            return false;
        }

        return $this->container->has($this->checkers[$type]);
    }
55491
public static function exists($type = 'post')
    {
        switch ($type) {
            case 'post':
                return (!empty($_POST)) ? true : false;
                break;
            case 'get':
                return (!empty($_GET)) ? true : false;
                break;
            default:
                return false;
                break;
        }
    }
842906
public function hasAutowiringType($type)
    {
        @trigger_error(sprintf('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".', $type), E_USER_DEPRECATED);

        return isset($this->autowiringTypes[$type]);
    }
1292549
public function setType( $type )
	{
		if ( $type == $this->getType() ) { return; }

		$this->_checkType( $type );

		$this->_values['type'] = (string) $type;
		$this->setModified();
	}
1170031
private static function isInternalPhpType(string $type): bool
    {
        return in_array(strtolower($type), self::$internalPhpTypes, true);
    }
560871
public function isNumeric( $type )
	{
		// BMS 2018-05-02 Changed to use resolvesToBaseType instead of relying on some property
		if ( $type instanceof QName )
		{
			// $type = $this->getType( $type->localName, $type->prefix );
			$type = "{$type->prefix}:{$type->localName}";
		}
		else if ( is_string( $type ) && isset( $this->types[ $type ] ) )
		{
			$type = $this->types[ $type ];
		}

		$result = $this->resolvesToBaseType( $type, array( 'xs:decimal', 'xs:double', 'xs:float' ) );
		return $result;

		// if ( is_array( $type ) )
		// {
		// 	return isset( $type['numeric'] ) && filter_var( $type['numeric'], FILTER_VALIDATE_BOOLEAN );
		// }
		// else
		// {
		// 	return false;
		// }
	}
279911
public static function validateType($type)
    {
        if (!in_array($type, [self::TYPE_INFO, self::TYPE_SUCCESS, self::TYPE_WARNING, self::TYPE_ERROR])) {
            throw new \InvalidArgumentException('Invalid resource message type "%s".', $type);
        }
    }
1192257
public static function isValidTransactionType($type)
    {
        $transactionTypes = \Genesis\Utils\Common::getClassConstants(__CLASS__);

        return in_array(strtolower($type), $transactionTypes);
    }
169297
public function has(string $type): bool
    {
        return isset($this->values[$type]) && \count($this->values[$type]) > 0;
    }
435529
protected function getValidatorType($type)
    {
        switch ($type) {
            case 'int':
                $type = 'Integer';
                break;
            case 'bool':
                $type = 'Boolean';
                break;
            case 'double':
                $type = 'Float';
                break;
            case 'numeric':
                $type = 'Number';
                break;
            case 'mixed':
                $type = 'Raw';
                break;
            default:
                $type = ucfirst($type);
        }
        return $type;
    }
1148264
public static function getCodeByType($type)
    {
        if (isset(self::$typeList[$type])) {
            return self::$typeList[$type];
        } else {
            return false;
        }
    }
261736
public function setType(?string $type): self
    {
        $this->type                          = $this->validateType($type);
        $this->type_hint || $this->type_hint = $this->type;

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

        $this->type = $type;

        return $this;
    }
302293
public function cacheInvalidate( $type = self::ALL )
    {
        switch( $type ) {
            case self::PERSISTED:
                $return = count( $this->instancesPersisted );
                $this->instancesPersisted = array();
                return $return;
            case self::UNPERSISTED:
                $return = count( $this->instancesUnpersisted );
                $this->instancesUnpersisted = array();
                return $return;
            case self::ALL:
                $return = count( $this->instancesPersisted ) + count( $this->instancesUnpersisted );
                $this->instancesPersisted = array();
                $this->instancesUnpersisted = array();
                return $return;
        }
        throw new \InvalidArgumentException("Bad source `{$source}` passed to " . __FUNCTION__);
    }