1
0
mirror of https://github.com/danog/loop.git synced 2024-11-26 20:04:44 +01:00
This commit is contained in:
Daniil Gentili 2020-07-21 22:20:03 +02:00
parent c8ca407d59
commit 6adc4d5d25
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -9,6 +9,7 @@
namespace danog\Loop\Generic;
use Amp\Promise;
use danog\Loop\ResumableSignalLoop;
/**
@ -68,7 +69,13 @@ class PeriodicLoop extends ResumableSignalLoop
if ($result) {
return;
}
yield $callback();
/** @psalm-suppress MixedAssignment */
$result = $callback();
if ($result instanceof \Generator) {
yield from $result;
} elseif ($result instanceof Promise) {
yield $result;
}
}
}
/**