src/AnnotationProcessor/PropertyInformation.php
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));
    }
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));
    }
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 ) ) ; }
Throw exceptions for invalid types or return the valid type.

@see http://php.net/manual/en/language.types.php

@param string $type

@throws \DomainException
@throws \InvalidArgumentException
@return string
Throw exceptions for invalid types or return the valid type .