Skip to content

Commit 224b788

Browse files
committed
KRF-266 #resolve Renamed methods Loop::{beforeTick, afterTick} to Loop::{onBeforeTick, Loop::onAfterTick}
1 parent 63fdb08 commit 224b788

File tree

5 files changed

+41
-22
lines changed

5 files changed

+41
-22
lines changed

Bridge/React/ReactLoop.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function isTimerActive(\React\EventLoop\Timer\TimerInterface $timer)
123123
*/
124124
public function nextTick(callable $listener)
125125
{
126-
$this->loop->beforeTick($listener);
126+
$this->loop->onBeforeTick($listener);
127127
}
128128

129129
/**
@@ -132,7 +132,7 @@ public function nextTick(callable $listener)
132132
*/
133133
public function futureTick(callable $listener)
134134
{
135-
$this->loop->afterTick($listener);
135+
$this->loop->onAfterTick($listener);
136136
}
137137

138138
/**

Loop.php

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,36 +175,45 @@ public function isTimerActive(TimerInterface $timer)
175175
* @override
176176
* @inheritDoc
177177
*/
178-
public function startTick(callable $listener)
178+
public function onStart(callable $listener)
179179
{
180-
$this->loop->startTick($listener);
180+
$this->loop->onStart($listener);
181181
}
182182

183183
/**
184184
* @override
185185
* @inheritDoc
186186
*/
187-
public function stopTick(callable $listener)
187+
public function onStop(callable $listener)
188188
{
189-
$this->loop->stopTick($listener);
189+
$this->loop->onStop($listener);
190190
}
191191

192192
/**
193193
* @override
194194
* @inheritDoc
195195
*/
196-
public function beforeTick(callable $listener)
196+
public function onTick(callable $listener)
197197
{
198-
$this->loop->beforeTick($listener);
198+
$this->loop->onAfterTick($listener);
199199
}
200200

201201
/**
202202
* @override
203203
* @inheritDoc
204204
*/
205-
public function afterTick(callable $listener)
205+
public function onBeforeTick(callable $listener)
206206
{
207-
$this->loop->afterTick($listener);
207+
$this->loop->onBeforeTick($listener);
208+
}
209+
210+
/**
211+
* @override
212+
* @inheritDoc
213+
*/
214+
public function onAfterTick(callable $listener)
215+
{
216+
$this->loop->onAfterTick($listener);
208217
}
209218

210219
/**

LoopInterface.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function isTimerActive(TimerInterface $timer);
9494
*
9595
* @param callable $listener
9696
*/
97-
public function startTick(callable $listener);
97+
public function onStart(callable $listener);
9898

9999
/**
100100
* Schedule a callback to be invoked on the stop tick of event loop.
@@ -103,7 +103,17 @@ public function startTick(callable $listener);
103103
*
104104
* @param callable $listener
105105
*/
106-
public function stopTick(callable $listener);
106+
public function onStop(callable $listener);
107+
108+
/**
109+
* Schedule a callback to be invoked on a future tick of the event loop.
110+
*
111+
* Callbacks are guaranteed to be executed in the order they are enqueued. This method is an alias for onAfterTick()
112+
* method.
113+
*
114+
* @param callable $listener
115+
*/
116+
public function onTick(callable $listener);
107117

108118
/**
109119
* Schedule a callback to be invoked on the next tick of the event loop.
@@ -112,7 +122,7 @@ public function stopTick(callable $listener);
112122
*
113123
* @param callable $listener
114124
*/
115-
public function beforeTick(callable $listener);
125+
public function onBeforeTick(callable $listener);
116126

117127
/**
118128
* Schedule a callback to be invoked on a future tick of the event loop.
@@ -121,5 +131,5 @@ public function beforeTick(callable $listener);
121131
*
122132
* @param callable $listener
123133
*/
124-
public function afterTick(callable $listener);
134+
public function onAfterTick(callable $listener);
125135
}

LoopModelInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function isTimerActive(TimerInterface $timer);
9595
*
9696
* @param callable $listener
9797
*/
98-
public function startTick(callable $listener);
98+
public function onStart(callable $listener);
9999

100100
/**
101101
* Schedule a callback to be invoked on the stop tick of event loop.
@@ -104,7 +104,7 @@ public function startTick(callable $listener);
104104
*
105105
* @param callable $listener
106106
*/
107-
public function stopTick(callable $listener);
107+
public function onStop(callable $listener);
108108

109109
/**
110110
* Schedule a callback to be invoked on the next tick of the event loop.
@@ -113,7 +113,7 @@ public function stopTick(callable $listener);
113113
*
114114
* @param callable $listener
115115
*/
116-
public function beforeTick(callable $listener);
116+
public function onBeforeTick(callable $listener);
117117

118118
/**
119119
* Schedule a callback to be invoked on a future tick of the event loop.
@@ -122,7 +122,7 @@ public function beforeTick(callable $listener);
122122
*
123123
* @param callable $listener
124124
*/
125-
public function afterTick(callable $listener);
125+
public function onAfterTick(callable $listener);
126126

127127
/**
128128
* Perform a single iteration of the event loop.

Model/SelectLoop.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public function isTimerActive(TimerInterface $timer)
225225
* @override
226226
* @inheritDoc
227227
*/
228-
public function startTick(callable $listener)
228+
public function onStart(callable $listener)
229229
{
230230
$this->startTickQueue->add($listener);
231231
}
@@ -234,7 +234,7 @@ public function startTick(callable $listener)
234234
* @override
235235
* @inheritDoc
236236
*/
237-
public function stopTick(callable $listener)
237+
public function onStop(callable $listener)
238238
{
239239
$this->stopTickQueue->add($listener);
240240
}
@@ -243,7 +243,7 @@ public function stopTick(callable $listener)
243243
* @override
244244
* @inheritDoc
245245
*/
246-
public function beforeTick(callable $listener)
246+
public function onBeforeTick(callable $listener)
247247
{
248248
$this->nextTickQueue->add($listener);
249249
}
@@ -252,7 +252,7 @@ public function beforeTick(callable $listener)
252252
* @override
253253
* @inheritDoc
254254
*/
255-
public function afterTick(callable $listener)
255+
public function onAfterTick(callable $listener)
256256
{
257257
$this->futureTickQueue->add($listener);
258258
}

0 commit comments

Comments
 (0)