final protected function getTypeFromPhpDeclaration(ReflectionMethod $method, ?string $typeDeclaration, bool $isEntityId = false): ?Type
    {
        if (!$typeDeclaration) {
            return null;
        }

        $isNullable = 0;
        $name = preg_replace('~(^\?|^null\||\|null$)~', '', $typeDeclaration, -1, $isNullable);

        $isList = 0;
        $name = preg_replace('~^(.*)\[\]$~', '$1', $name, -1, $isList);
        $name = $this->adjustNamespace($method, $name);
        $type = $this->getTypeFromRegistry($name, $isEntityId);

        if ($isList) {
            $type = Type::listOf($type);
        }

        if (!$isNullable) {
            $type = Type::nonNull($type);
        }

        return $type;
    }
final protected function getTypeFromPhpDeclaration(ReflectionMethod $method, ?string $typeDeclaration, bool $isEntityId = false): ?Type
    {
        if (!$typeDeclaration) {
            return null;
        }

        $isNullable = 0;
        $name = preg_replace('~(^\?|^null\||\|null$)~', '', $typeDeclaration, -1, $isNullable);

        $isList = 0;
        $name = preg_replace('~^(.*)\[\]$~', '$1', $name, -1, $isList);
        $name = $this->adjustNamespace($method, $name);
        $type = $this->getTypeFromRegistry($name, $isEntityId);

        if ($isList) {
            $type = Type::listOf($type);
        }

        if (!$isNullable) {
            $type = Type::nonNull($type);
        }

        return $type;
    }
final protected function getTypeFromPhpDeclaration ( ReflectionMethod $ method , ? string $ typeDeclaration , bool $ isEntityId = false ) : ? Type { if ( ! $ typeDeclaration ) { return null ; } $ isNullable = 0 ; $ name = preg_replace ( '~(^\?|^null\||\|null$)~' , '' , $ typeDeclaration , - 1 , $ isNullable ) ; $ isList = 0 ; $ name = preg_replace ( '~^(.*)\[\]$~' , '$1' , $ name , - 1 , $ isList ) ; $ name = $ this -> adjustNamespace ( $ method , $ name ) ; $ type = $ this -> getTypeFromRegistry ( $ name , $ isEntityId ) ; if ( $ isList ) { $ type = Type :: listOf ( $ type ) ; } if ( ! $ isNullable ) { $ type = Type :: nonNull ( $ type ) ; } return $ type ; }
Get instance of GraphQL type from a PHP class name

Supported syntaxes are the following:

- `?MyType`
- `null|MyType`
- `MyType|null`
- `MyType[]`
- `?MyType[]`
- `null|MyType[]`
- `MyType[]|null`

@param ReflectionMethod $method
@param null|string $typeDeclaration
@param bool $isEntityId

@return null|Type
Get instance of GraphQL type from a PHP class name