<?php

declare(strict_types=1);

namespace Roave\BetterReflection\TypesFinder;

use phpDocumentor\Reflection\Type;
use phpDocumentor\Reflection\TypeResolver;
use phpDocumentor\Reflection\Types\Context;

class ResolveTypes
{
    /** @var TypeResolver */
    private $typeResolver;

    public function __construct()
    {
        $this->typeResolver = new TypeResolver();
    }

    /**
     * @param string[] $stringTypes
     * @return Type[]
     */
    public function __invoke(array $stringTypes, Context $context) : array
    {
        $resolvedTypes = [];

        foreach ($stringTypes as $stringType) {
            $resolvedTypes[] = $this->typeResolver->resolve($stringType, $context);
        }

        /** @var Type[] */
        return $resolvedTypes;
    }
}

<?php

declare(strict_types=1);

namespace Roave\BetterReflection\TypesFinder;

use phpDocumentor\Reflection\Type;
use phpDocumentor\Reflection\TypeResolver;
use phpDocumentor\Reflection\Types\Context;

class ResolveTypes
{
    /** @var TypeResolver */
    private $typeResolver;

    public function __construct()
    {
        $this->typeResolver = new TypeResolver();
    }

    /**
     * @param string[] $stringTypes
     * @return Type[]
     */
    public function __invoke(array $stringTypes, Context $context) : array
    {
        $resolvedTypes = [];

        foreach ($stringTypes as $stringType) {
            /** @var Type $resolvedType */
            $resolvedType = $this->typeResolver->resolve($stringType, $context);
            $resolvedTypes[] = $resolvedType;
        }

        return $resolvedTypes;
    }
}

Remove null type in docblock before assigning to array variable
Remove null type in docblock before assigning to array variable