• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

azjezz / psl / 22520865518

28 Feb 2026 12:36PM UTC coverage: 97.768% (+0.2%) from 97.532%
22520865518

Pull #586

github

azjezz
more tests

Signed-off-by: azjezz <azjezz@protonmail.com>
Pull Request #586: add more tests

16 of 16 new or added lines in 4 files covered. (100.0%)

20 existing lines in 13 files now uncovered.

7492 of 7663 relevant lines covered (97.77%)

43.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

73.33
/src/Psl/Channel/Internal/UnboundedReceiver.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Psl\Channel\Internal;
6

7
use Psl\Channel\Exception;
8
use Psl\Channel\ReceiverInterface;
9
use Revolt\EventLoop;
10
use Revolt\EventLoop\Suspension;
11

12
/**
13
 * @template T
14
 *
15
 * @implements ReceiverInterface<T>
16
 */
17
final class UnboundedReceiver implements ReceiverInterface
18
{
19
    /**
20
     * @use ChannelSideTrait<UnboundedChannelState<T>>
21
     */
22
    use ChannelSideTrait;
23

24
    private null|Suspension $suspension = null;
25

26
    /**
27
     * @param UnboundedChannelState<T> $state
28
     */
29
    public function __construct(UnboundedChannelState $state)
30
    {
31
        $this->state = $state;
54✔
32
    }
33

34
    /**
35
     * @inheritDoc
36
     */
37
    #[\Override]
38
    public function receive(): mixed
39
    {
40
        if ($this->suspension) {
49✔
UNCOV
41
            $suspension = EventLoop::getSuspension();
×
42
            $this->suspension = $suspension;
×
43
            $this->state->waitForMessage($suspension);
×
44
            $suspension->suspend();
×
45
        }
46

47
        try {
48
            return $this->state->receive();
49✔
49
        } catch (Exception\EmptyChannelException) {
48✔
50
            $suspension = EventLoop::getSuspension();
48✔
51
            $this->suspension = $suspension;
48✔
52
            $this->state->waitForMessage($suspension);
48✔
53
            $suspension->suspend();
48✔
54

55
            return $this->state->receive();
48✔
56
        } finally {
57
            $this->suspension = null;
49✔
58
        }
59
    }
60

61
    /**
62
     * @inheritDoc
63
     */
64
    #[\Override]
65
    public function tryReceive(): mixed
66
    {
67
        return $this->state->receive();
1✔
68
    }
69
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc