mirror of
https://github.com/danog/loop.git
synced 2024-11-30 04:19:04 +01:00
Update
This commit is contained in:
parent
b39135ed3e
commit
992c3560d0
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
![Build status](https://github.com/danog/loop/workflows/build/badge.svg)
|
![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)
|
[![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 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)
|
[![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)
|
![License](https://img.shields.io/badge/license-MIT-blue.svg)
|
||||||
|
@ -78,6 +78,7 @@ abstract class Loop implements Stringable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->running = true;
|
$this->running = true;
|
||||||
|
/** @infection-ignore-all */
|
||||||
if (!$this->resume()) {
|
if (!$this->resume()) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
throw new AssertionError("Could not resume!");
|
throw new AssertionError("Could not resume!");
|
||||||
@ -110,6 +111,7 @@ abstract class Loop implements Stringable
|
|||||||
if ($this->paused) {
|
if ($this->paused) {
|
||||||
$this->exitedLoop();
|
$this->exitedLoop();
|
||||||
} else {
|
} else {
|
||||||
|
/** @infection-ignore-all */
|
||||||
if ($this->shutdownDeferred !== null) {
|
if ($this->shutdownDeferred !== null) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
throw new AssertionError("Shutdown deferred is not null!");
|
throw new AssertionError("Shutdown deferred is not null!");
|
||||||
@ -124,11 +126,13 @@ abstract class Loop implements Stringable
|
|||||||
private bool $paused = true;
|
private bool $paused = true;
|
||||||
private function loopInternal(): void
|
private function loopInternal(): void
|
||||||
{
|
{
|
||||||
|
/** @infection-ignore-all */
|
||||||
if (!$this->running) {
|
if (!$this->running) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
throw new AssertionError("Already running!");
|
throw new AssertionError("Already running!");
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
}
|
}
|
||||||
|
/** @infection-ignore-all */
|
||||||
if (!$this->paused) {
|
if (!$this->paused) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
throw new AssertionError("Already paused!");
|
throw new AssertionError("Already paused!");
|
||||||
@ -156,6 +160,7 @@ abstract class Loop implements Stringable
|
|||||||
$this->reportPause(0.0);
|
$this->reportPause(0.0);
|
||||||
} else {
|
} else {
|
||||||
if (!$this->resumeImmediate) {
|
if (!$this->resumeImmediate) {
|
||||||
|
/** @infection-ignore-all */
|
||||||
if ($this->resumeTimer !== null) {
|
if ($this->resumeTimer !== null) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
throw new AssertionError("Already have a resume timer!");
|
throw new AssertionError("Already have a resume timer!");
|
||||||
@ -176,11 +181,13 @@ abstract class Loop implements Stringable
|
|||||||
{
|
{
|
||||||
$this->running = false;
|
$this->running = false;
|
||||||
$this->paused = true;
|
$this->paused = true;
|
||||||
|
/** @infection-ignore-all */
|
||||||
if ($this->resumeTimer !== null) {
|
if ($this->resumeTimer !== null) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
throw new AssertionError("Already have a resume timer!");
|
throw new AssertionError("Already have a resume timer!");
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
}
|
}
|
||||||
|
/** @infection-ignore-all */
|
||||||
if ($this->resumeImmediate !== null) {
|
if ($this->resumeImmediate !== null) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
throw new AssertionError("Already have a resume immediate timer!");
|
throw new AssertionError("Already have a resume immediate timer!");
|
||||||
|
Loading…
Reference in New Issue
Block a user