Skip to content

Commit

Permalink
Merge pull request #109 from ColinHDev/trap
Browse files Browse the repository at this point in the history
Await: Added (PHPStan's) PhpDoc annotations to trap() method
  • Loading branch information
SOF3 authored Feb 7, 2022
2 parents 9337932 + 3dd02a3 commit 3cefecd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions await-generator/src/SOFe/AwaitGenerator/Await.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ public static function race(array $generators) : Generator{

/**
* Wraps a generator that executes some action before and after suspension points (`yield`s).
* @phpstan-template TKey
* @phpstan-template TValue
* @phpstan-template TSend
* @phpstan-template TReturn
* @phpstan-param Generator<TKey, TValue, TSend, TReturn> $generator
* @phpstan-param Closure(Generator, TValue, TKey): bool $beforeSuspend
* @phpstan-param Closure(Generator, TValue, TKey, TSend): bool $afterSuspend
* @phpstan-return Generator<TKey, TValue, TSend, TReturn>
*/
public static function trap(Generator $generator, Closure $beforeSuspend, Closure $afterSuspend) : Generator {
while($generator->valid()) {
Expand Down

0 comments on commit 3cefecd

Please sign in to comment.