mirror of
https://github.com/danog/loop.git
synced 2024-12-02 09:17:51 +01:00
Cs-fix and psalm fixes
This commit is contained in:
parent
db84c4851f
commit
b1941cc6a7
@ -41,7 +41,7 @@ interface ResumableLoopInterface extends LoopInterface
|
|||||||
public function resumeDefer(): Promise;
|
public function resumeDefer(): Promise;
|
||||||
/**
|
/**
|
||||||
* Defer resuming the loop to next tick.
|
* Defer resuming the loop to next tick.
|
||||||
*
|
*
|
||||||
* Multiple consecutive calls will yield only one resume.
|
* Multiple consecutive calls will yield only one resume.
|
||||||
*
|
*
|
||||||
* @return Promise Resolved when the loop is paused again
|
* @return Promise Resolved when the loop is paused again
|
||||||
|
@ -67,6 +67,7 @@ trait ResumableLoop
|
|||||||
AmpLoop::cancel($this->resumeTimer);
|
AmpLoop::cancel($this->resumeTimer);
|
||||||
$this->resumeTimer = null;
|
$this->resumeTimer = null;
|
||||||
}
|
}
|
||||||
|
/** @psalm-suppress MixedArgumentTypeCoercion */
|
||||||
$this->resumeTimer = AmpLoop::delay($time, \Closure::fromCallable([$this, 'resumeInternal']));
|
$this->resumeTimer = AmpLoop::delay($time, \Closure::fromCallable([$this, 'resumeInternal']));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,6 +104,7 @@ trait ResumableLoop
|
|||||||
*/
|
*/
|
||||||
public function resumeDefer(): Promise
|
public function resumeDefer(): Promise
|
||||||
{
|
{
|
||||||
|
/** @psalm-suppress MixedArgumentTypeCoercion */
|
||||||
AmpLoop::defer(Closure::fromCallable([$this, 'resumeInternal']));
|
AmpLoop::defer(Closure::fromCallable([$this, 'resumeInternal']));
|
||||||
if (!$this->pause) {
|
if (!$this->pause) {
|
||||||
$this->pause = new Deferred;
|
$this->pause = new Deferred;
|
||||||
@ -111,7 +113,7 @@ trait ResumableLoop
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Defer resuming the loop to next tick.
|
* Defer resuming the loop to next tick.
|
||||||
*
|
*
|
||||||
* Multiple consecutive calls will yield only one resume.
|
* Multiple consecutive calls will yield only one resume.
|
||||||
*
|
*
|
||||||
* @return Promise Resolved when the loop is paused again
|
* @return Promise Resolved when the loop is paused again
|
||||||
|
@ -63,6 +63,7 @@ trait SignalLoop
|
|||||||
public function waitSignal($promise): Promise
|
public function waitSignal($promise): Promise
|
||||||
{
|
{
|
||||||
if ($promise instanceof \Generator) {
|
if ($promise instanceof \Generator) {
|
||||||
|
/** @psalm-suppress MixedArgumentTypeCoercion */
|
||||||
$promise = new Coroutine($promise);
|
$promise = new Coroutine($promise);
|
||||||
}
|
}
|
||||||
$this->signalDeferred = new Deferred();
|
$this->signalDeferred = new Deferred();
|
||||||
|
@ -105,7 +105,7 @@ class ResumableTest extends Fixtures
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test pausing loop and then resuming it with deferOnce
|
* Test pausing loop and then resuming it with deferOnce.
|
||||||
*
|
*
|
||||||
* @param ResumableInterface $loop Loop
|
* @param ResumableInterface $loop Loop
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user