If you call a function that yields, you will not execute that function. You'll get back a generator. To execute the function, you (or the event loop) will interact with that generator.
Also, "return" means something different for a generator than for a normal function. The yield keyword changes everything.
$g = gen(1);
$a = $g->current();
2
$b = yield $arg1 + 1;
$c = $g->send($a + 1);
$d = yield $b + 2;
5
3
function gen($arg1)
$e = $g->send($c + 1);
6
return $d + 2;
null
echo $g->getReturn();
8