public function testGetReturnStatementAstReturnsStatements()
{
$php = <<<'PHP'
<?php
function foo($a) {
if ($a) {
return 0;
}
return ($a + 3);
}
PHP;
$reflector = new FunctionReflector(new StringSourceLocator($php));
$function = $reflector->reflect('foo');
$nodes = $function->getReturnStatementsAst();
$this->assertCount(2, $nodes);
$this->assertContainsOnlyInstancesOf(Return_::class, $nodes);
reset($nodes);
/** @var Return_ $first */
$first = current($nodes);
/** @var Return_ $second */
$second = next($nodes);
$this->assertInstanceOf(LNumber::class, $first->expr);
$this->assertInstanceOf(BinaryOp\Plus::class, $second->expr);
}