Skip to content

Commit 9ecb503

Browse files
committed
Improve coverage
1 parent 54d524b commit 9ecb503

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/Loop.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ public function start(): bool
6767
}
6868
$this->running = true;
6969
if (!$this->resume()) {
70+
// @codeCoverageIgnoreStart
7071
throw new AssertionError("Could not resume!");
72+
// @codeCoverageIgnoreEnd
7173
}
7274
$this->startedLoop();
7375
return true;
@@ -104,10 +106,14 @@ abstract protected function loop(): ?float;
104106
private function loopInternal(): void
105107
{
106108
if (!$this->running) {
109+
// @codeCoverageIgnoreStart
107110
throw new AssertionError("Already running!");
111+
// @codeCoverageIgnoreEnd
108112
}
109113
if (!$this->paused) {
114+
// @codeCoverageIgnoreStart
110115
throw new AssertionError("Already paused!");
116+
// @codeCoverageIgnoreEnd
111117
}
112118
$this->paused = false;
113119
try {
@@ -132,7 +138,9 @@ private function loopInternal(): void
132138
} else {
133139
if (!$this->resumeImmediate) {
134140
if ($this->resumeTimer !== null) {
141+
// @codeCoverageIgnoreStart
135142
throw new AssertionError("Already have a resume timer!");
143+
// @codeCoverageIgnoreEnd
136144
}
137145
$this->resumeTimer = EventLoop::delay($timeout, function (): void {
138146
$this->resumeTimer = null;
@@ -148,10 +156,14 @@ private function exitedLoopInternal(): void
148156
$this->running = false;
149157
$this->paused = true;
150158
if ($this->resumeTimer !== null) {
159+
// @codeCoverageIgnoreStart
151160
throw new AssertionError("Already have a resume timer!");
161+
// @codeCoverageIgnoreEnd
152162
}
153163
if ($this->resumeTimer !== null) {
164+
// @codeCoverageIgnoreStart
154165
throw new AssertionError("Already have a resume immediate timer!");
166+
// @codeCoverageIgnoreEnd
155167
}
156168
$this->exitedLoop();
157169
}

0 commit comments

Comments
 (0)