1
0
mirror of https://github.com/danog/loop.git synced 2024-11-29 20:09:04 +01:00
This commit is contained in:
Daniil Gentili 2023-09-30 15:31:35 +02:00
parent b39135ed3e
commit 992c3560d0
2 changed files with 7 additions and 1 deletions

View File

@ -2,7 +2,6 @@
![Build status](https://github.com/danog/loop/workflows/build/badge.svg)
[![codecov](https://codecov.io/gh/danog/loop/branch/master/graph/badge.svg)](https://codecov.io/gh/danog/loop)
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fdanog%2Floop%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/danog/loop/master)
[![Psalm coverage](https://shepherd.dev/github/danog/loop/coverage.svg)](https://shepherd.dev/github/danog/loop)
[![Psalm level 1](https://shepherd.dev/github/danog/loop/level.svg)](https://shepherd.dev/github/danog/loop)
![License](https://img.shields.io/badge/license-MIT-blue.svg)

View File

@ -78,6 +78,7 @@ abstract class Loop implements Stringable
return false;
}
$this->running = true;
/** @infection-ignore-all */
if (!$this->resume()) {
// @codeCoverageIgnoreStart
throw new AssertionError("Could not resume!");
@ -110,6 +111,7 @@ abstract class Loop implements Stringable
if ($this->paused) {
$this->exitedLoop();
} else {
/** @infection-ignore-all */
if ($this->shutdownDeferred !== null) {
// @codeCoverageIgnoreStart
throw new AssertionError("Shutdown deferred is not null!");
@ -124,11 +126,13 @@ abstract class Loop implements Stringable
private bool $paused = true;
private function loopInternal(): void
{
/** @infection-ignore-all */
if (!$this->running) {
// @codeCoverageIgnoreStart
throw new AssertionError("Already running!");
// @codeCoverageIgnoreEnd
}
/** @infection-ignore-all */
if (!$this->paused) {
// @codeCoverageIgnoreStart
throw new AssertionError("Already paused!");
@ -156,6 +160,7 @@ abstract class Loop implements Stringable
$this->reportPause(0.0);
} else {
if (!$this->resumeImmediate) {
/** @infection-ignore-all */
if ($this->resumeTimer !== null) {
// @codeCoverageIgnoreStart
throw new AssertionError("Already have a resume timer!");
@ -176,11 +181,13 @@ abstract class Loop implements Stringable
{
$this->running = false;
$this->paused = true;
/** @infection-ignore-all */
if ($this->resumeTimer !== null) {
// @codeCoverageIgnoreStart
throw new AssertionError("Already have a resume timer!");
// @codeCoverageIgnoreEnd
}
/** @infection-ignore-all */
if ($this->resumeImmediate !== null) {
// @codeCoverageIgnoreStart
throw new AssertionError("Already have a resume immediate timer!");