Check if the return annotation type is valid.

@param string $type The type value of the return annotation

@return bool Type is valid
485282
private function isFixableReturnType(string $type): bool
    {
        // $type === null is not valid in our slevomat helper.
        return TypeHintHelper::isSimpleTypeHint($type) || $type === 'null' || $this->isCustomArrayType($type);
    }
83066
protected function isValid($type, $data)
    {
        $type = $this->getTypeName($type);

        switch ($type) {
            case 'number':
                return is_numeric($data);
            case 'int':
                return is_numeric($data) && strpos((string) $data, '.') === false;
            case 'float':
                return is_numeric($data) && strpos((string) $data, '.') !== false;
            case 'file':
                return is_string($data) && file_exists($data);
            case 'folder':
                return is_string($data) && is_dir($data);
            case 'email':
                return is_string($data) && $this->isEmail($data);
            case 'url':
                return is_string($data) && $this->isUrl($data);
            case 'html':
                return is_string($data) && $this->isHtml($data);
            case 'cc':
                return (is_string($data) || is_int($data)) && $this->isCreditCard($data);
            case 'hex':
                return is_string($data) && $this->isHex($data);
            case 'alphanum':
                return is_string($data) && $this->alphaNum($data);
            case 'alphanumscore':
                return is_string($data) && $this->alphaNumScore($data);
            case 'alphanumhyphen':
                return is_string($data) && $this->alphaNumHyphen($data);
            case 'alphanumline':
                return is_string($data) && $this->alphaNumLine($data);
            default:
                break;
        }

        $method = 'is_'.$type;
        if (function_exists($method)) {
            return $method($data);
        }

        if (class_exists($type)) {
            return $data instanceof $type;
        }

        return true;
    }
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");
        }
    }
1226938
public function hasFlagsOfType($type)
    {
        if ($this->flags === null) {
            return false;
        }

        foreach ($this->flags as $flag) {
            if ($flag->type == $type) {
                return true;
            }
        }

        return false;
    }
686345
protected static function is_numeric( $type ) {
		switch ( $type ) {
			case self::INT:
			case self::TINYINT:
			case self::MEDIUMINT:
			case self::BIGINT:
			case self::DOUBLE:
			case self::FLOAT:
			case self::REAL:
			case self::DECIMAL:
				return true;
				break;
			default:
				return false;
				break;
		}
	}
942623
public function validatePropertyType($type)
    {
        if (!in_array($type, $this->getPropertyTypes())) {
            throw $this->getException(
                'The property type isn\'t valid ("%s" given, expecting one of following: %s)',
                [$type, implode(', ', $this->getPropertyTypes())]
            );
        }

        return $type;
    }
1170031
private static function isInternalPhpType(string $type): bool
    {
        return in_array(strtolower($type), self::$internalPhpTypes, true);
    }
827652
public static function isAllowed($type){
        return (!empty($type) && (in_array($type, self::$allowedTypes))) || self::isAssessmentItem($type) || self::isAssessmentTest($type);
    }
1051135
protected function isFatalError($type)
    {
        $errorCodes = [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE];

        if (\defined('FATAL_ERROR')) {
            $errorCodes[] = FATAL_ERROR;
        }

        return \in_array($type, $errorCodes);
    }
1077881
private function validateType(string $type): string
    {
        if ('' === $type) {
            throw new \DomainException(sprintf('A type name may not be empty'));
        }

        if ((int) $type) {
            throw new \DomainException(sprintf('A type name may not start with a number. Found %s', $type));
        }

        if (\in_array($type, static::getValidTypes(), true)) {
            // Scalar.
            return $type;
        }

        if ('\\' === $type[0] || ctype_upper($type[0])) {
            // Class.
            return $type;
        }

        throw new \DomainException(sprintf('The type %s is not supported for code generation', $type));
    }
588285
public function isSatisfiedBy(ReturnType\TypeInterface $type)
    {
        if (false == $type->isRealType()) {
            return false;
        }

        switch ($type->getDataType()) {
            case Types::T_INT:
            case Types::T_UINT:
            case Types::T_CHAR:
            case Types::T_UCHAR:
            case Types::T_LONG:
            case Types::T_ULONG:
                return true;
            default:
                return false;
        }
    }
739640
public function is($type = null)
    {
        if ($type === null) {
            return $this->is;
        } else {
            return $type == $this->is;
        }
    }
657054
public function areReturnTypesNullCompatible($type = null)
    {
        if (\count($this->returnTypes)) {
            foreach ($this->returnTypes as $returnType => $definition) {
                switch ($returnType) {
                    case 'null':
                        return true;
                }
            }
        }

        return false;
    }
140013
public function getFormat($type)
    {
        if (!$this->typeIsAvailable($type)) {
            return false;
        }

        if (isset($this->formats[$type])) {
            return $this->formats[$type];
        }

        if (!is_null($this->getDefaultFormat())) {
            return $this->getDefaultFormat();
        }

        return false;
    }
1079737
public function rules($type)
	{
		$type = strtolower(trim($type));

		if (!isset($this->rules[$type]))
		{
			throw new InvalidArgumentException(sprintf('Rule type of %s not supported', $type));
		}

		return $this->rules[$type];
	}
172216
public function isValid($type = 'both')
	{
		$type  = strtolower($type);
		$flags = 0;

		if ($type === 'ipv4')
		{
			$flags = FILTER_FLAG_IPV4;
		}
		if ($type === 'ipv6')
		{
			$flags = FILTER_FLAG_IPV6;
		}

		return (bool) filter_var($this->ip, FILTER_VALIDATE_IP, ['flags' => $flags]);
	}
387476
public function isType($type)
    {
        if ($this->has(strtolower($type))) {
            return true;
        }

        return $this->detectType() === $type;
    }