Skip to content

Commit 3cefecd

Browse files
authored
Merge pull request #109 from ColinHDev/trap
Await: Added (PHPStan's) PhpDoc annotations to trap() method
2 parents 9337932 + 3dd02a3 commit 3cefecd

File tree

1 file changed

+8
-0
lines changed
  • await-generator/src/SOFe/AwaitGenerator

1 file changed

+8
-0
lines changed

await-generator/src/SOFe/AwaitGenerator/Await.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ public static function race(array $generators) : Generator{
191191

192192
/**
193193
* Wraps a generator that executes some action before and after suspension points (`yield`s).
194+
* @phpstan-template TKey
195+
* @phpstan-template TValue
196+
* @phpstan-template TSend
197+
* @phpstan-template TReturn
198+
* @phpstan-param Generator<TKey, TValue, TSend, TReturn> $generator
199+
* @phpstan-param Closure(Generator, TValue, TKey): bool $beforeSuspend
200+
* @phpstan-param Closure(Generator, TValue, TKey, TSend): bool $afterSuspend
201+
* @phpstan-return Generator<TKey, TValue, TSend, TReturn>
194202
*/
195203
public static function trap(Generator $generator, Closure $beforeSuspend, Closure $afterSuspend) : Generator {
196204
while($generator->valid()) {

0 commit comments

Comments
 (0)