@@ -129,10 +129,14 @@ public static function stop()
129
129
/**
130
130
* Defer the execution of a callback.
131
131
*
132
- * @param callable(string $watcherId, mixed $data) $callback The callback to defer.
132
+ * The deferred callable MUST be executed in the next tick of the event loop and before any other type of watcher.
133
+ * Order of enabling MUST be preserved when executing the callbacks.
134
+ *
135
+ * @param callable(string $watcherId, mixed $data) $callback The callback to defer. The `$watcherId` will be
136
+ * invalidated before the callback call.
133
137
* @param mixed $data Arbitrary data given to the callback function as the `$data` parameter.
134
138
*
135
- * @return string An identifier that can be used to cancel, enable or disable the watcher.
139
+ * @return string An unique identifier that can be used to cancel, enable or disable the watcher.
136
140
*/
137
141
public static function defer (callable $ callback , $ data = null )
138
142
{
@@ -143,13 +147,15 @@ public static function defer(callable $callback, $data = null)
143
147
/**
144
148
* Delay the execution of a callback.
145
149
*
146
- * The delay is a minimum and approximate, accuracy is not guaranteed.
150
+ * The delay is a minimum and approximate, accuracy is not guaranteed. Order of calls MUST be determined by which
151
+ * timers expire first, but timers with the same expiration time MAY be executed in any order.
147
152
*
148
- * @param int $time The amount of time, in milliseconds, to delay the execution for.
149
- * @param callable(string $watcherId, mixed $data) $callback The callback to delay.
153
+ * @param int $delay The amount of time, in milliseconds, to delay the execution for.
154
+ * @param callable(string $watcherId, mixed $data) $callback The callback to delay. The `$watcherId` will be
155
+ * invalidated before the callback call.
150
156
* @param mixed $data Arbitrary data given to the callback function as the `$data` parameter.
151
157
*
152
- * @return string An identifier that can be used to cancel, enable or disable the watcher.
158
+ * @return string An unique identifier that can be used to cancel, enable or disable the watcher.
153
159
*/
154
160
public static function delay ($ time , callable $ callback , $ data = null )
155
161
{
@@ -160,14 +166,15 @@ public static function delay($time, callable $callback, $data = null)
160
166
/**
161
167
* Repeatedly execute a callback.
162
168
*
163
- * The interval between executions is a minimum and approximate, accuracy is not guaranteed.
169
+ * The interval between executions is a minimum and approximate, accuracy is not guaranteed. Order of calls MUST be
170
+ * determined by which timers expire first, but timers with the same expiration time MAY be executed in any order.
164
171
* The first execution is scheduled after the first interval period.
165
172
*
166
173
* @param int $interval The time interval, in milliseconds, to wait between executions.
167
174
* @param callable(string $watcherId, mixed $data) $callback The callback to repeat.
168
175
* @param mixed $data Arbitrary data given to the callback function as the `$data` parameter.
169
176
*
170
- * @return string An identifier that can be used to cancel, enable or disable the watcher.
177
+ * @return string An unique identifier that can be used to cancel, enable or disable the watcher.
171
178
*/
172
179
public static function repeat ($ interval , callable $ callback , $ data = null )
173
180
{
@@ -179,11 +186,11 @@ public static function repeat($interval, callable $callback, $data = null)
179
186
* Execute a callback when a stream resource becomes readable or is closed for reading.
180
187
*
181
188
* Warning: Closing resources locally, e.g. with `fclose`, might not invoke the callback. Be sure to `cancel` the
182
- * watcher when closing the resource locally. Drivers may choose to notify the user if there are watchers on invalid
189
+ * watcher when closing the resource locally. Drivers MAY choose to notify the user if there are watchers on invalid
183
190
* resources, but are not required to, due to the high performance impact. Watchers on closed resources are
184
191
* therefore undefined behavior.
185
192
*
186
- * Multiple watchers on the same stream may be executed in any order.
193
+ * Multiple watchers on the same stream MAY be executed in any order.
187
194
*
188
195
* @param resource $stream The stream to monitor.
189
196
* @param callable(string $watcherId, resource $stream, mixed $data) $callback The callback to execute.
@@ -201,11 +208,11 @@ public static function onReadable($stream, callable $callback, $data = null)
201
208
* Execute a callback when a stream resource becomes writable or is closed for writing.
202
209
*
203
210
* Warning: Closing resources locally, e.g. with `fclose`, might not invoke the callback. Be sure to `cancel` the
204
- * watcher when closing the resource locally. Drivers may choose to notify the user if there are watchers on invalid
211
+ * watcher when closing the resource locally. Drivers MAY choose to notify the user if there are watchers on invalid
205
212
* resources, but are not required to, due to the high performance impact. Watchers on closed resources are
206
213
* therefore undefined behavior.
207
214
*
208
- * Multiple watchers on the same stream may be executed in any order.
215
+ * Multiple watchers on the same stream MAY be executed in any order.
209
216
*
210
217
* @param resource $stream The stream to monitor.
211
218
* @param callable(string $watcherId, resource $stream, mixed $data) $callback The callback to execute.
@@ -223,10 +230,10 @@ public static function onWritable($stream, callable $callback, $data = null)
223
230
* Execute a callback when a signal is received.
224
231
*
225
232
* Warning: Installing the same signal on different instances of this interface is deemed undefined behavior.
226
- * Implementations may try to detect this, if possible, but are not required to. This is due to technical
233
+ * Implementations MAY try to detect this, if possible, but are not required to. This is due to technical
227
234
* limitations of the signals being registered globally per process.
228
235
*
229
- * Multiple watchers on the same signal may be executed in any order.
236
+ * Multiple watchers on the same signal MAY be executed in any order.
230
237
*
231
238
* @param int $signo The signal number to monitor.
232
239
* @param callable(string $watcherId, int $signo, mixed $data) $callback The callback to execute.
0 commit comments