public function testFindReturnTypeForFunction($docBlock, $expectedInstances)
{
$docBlock = "/**\n * {$docBlock}\n */";
$function = $this->createMock(ReflectionFunction::class);
$function->expects($this->once())->method('getDocComment')->will($this->returnValue($docBlock));
$function->expects($this->once())->method('getLocatedSource')->will($this->returnValue(new LocatedSource('<?php', null)));
/* @var ReflectionFunction $function */
$foundTypes = (new FindReturnType())->__invoke($function);
$this->assertCount(count($expectedInstances), $foundTypes);
foreach ($expectedInstances as $i => $expectedInstance) {
$this->assertInstanceOf($expectedInstance, $foundTypes[$i]);
}
}