@@ -32,7 +32,7 @@ Here is an async HTTP server built with just the event loop.
3232$loop = React\EventLoop\Factory::create();
3333
3434$server = stream_socket_server('tcp://127.0.0.1:8080');
35- stream_set_blocking($server, 0 );
35+ stream_set_blocking($server, false );
3636
3737$loop->addReadStream($server, function ($server) use ($loop) {
3838 $conn = stream_socket_accept($server);
@@ -97,7 +97,7 @@ $loop->run();
9797## Factory
9898
9999The ` Factory ` class exists as a convenient way to pick the best available
100- [ loop implementation) (#loop-implementation ).
100+ [ loop implementation] ( #loop-implementations ) .
101101
102102The ` create(): LoopInterface ` method can be used to create a new loop
103103instance:
@@ -170,14 +170,14 @@ If you want to access any variables within your callback function, you
170170can bind arbitrary data to a callback closure like this:
171171
172172``` php
173- function hello(LoopInterface $loop, $name )
173+ function hello($name, LoopInterface $loop )
174174{
175175 $loop->addTimer(1.0, function () use ($name) {
176176 echo "hello $name\n";
177177 });
178178}
179179
180- hello('Tester');
180+ hello('Tester', $loop );
181181```
182182
183183The execution order of timers scheduled to execute at the same time is
@@ -218,7 +218,7 @@ If you want to limit the number of executions, you can bind
218218arbitrary data to a callback closure like this:
219219
220220``` php
221- function hello(LoopInterface $loop, $name )
221+ function hello($name, LoopInterface $loop )
222222{
223223 $n = 3;
224224 $loop->addPeriodicTimer(1.0, function ($timer) use ($name, $loop, & $n) {
@@ -231,7 +231,7 @@ function hello(LoopInterface $loop, $name)
231231 });
232232}
233233
234- hello('Tester');
234+ hello('Tester', $loop );
235235```
236236
237237The execution order of timers scheduled to execute at the same time is
@@ -245,11 +245,12 @@ cancel a pending timer.
245245See also [ ` addPeriodicTimer() ` ] ( #addperiodictimer ) and [ example #2 ] ( examples ) .
246246
247247You can use the [ ` isTimerActive() ` ] ( #istimeractive ) method to check if
248- this timer is still "active". After a timer is successfully canceled ,
248+ this timer is still "active". After a timer is successfully cancelled ,
249249it is no longer considered "active".
250250
251251Calling this method on a timer instance that has not been added to this
252- loop instance or on a timer
252+ loop instance or on a timer that is not "active" (or has already been
253+ cancelled) has no effect.
253254
254255### isTimerActive()
255256
@@ -258,7 +259,7 @@ check if a given timer is active.
258259
259260A timer is considered "active" if it has been added to this loop instance
260261via [ ` addTimer() ` ] ( #addtimer ) or [ ` addPeriodicTimer() ` ] ( #addperiodictimer )
261- and has not been canceled via [ ` cancelTimer() ` ] ( #canceltimer ) and is not
262+ and has not been cancelled via [ ` cancelTimer() ` ] ( #canceltimer ) and is not
262263a non-periodic timer that has already been triggered after its interval.
263264
264265### futureTick()
@@ -280,14 +281,14 @@ If you want to access any variables within your callback function, you
280281can bind arbitrary data to a callback closure like this:
281282
282283``` php
283- function hello(LoopInterface $loop, $name )
284+ function hello($name, LoopInterface $loop )
284285{
285286 $loop->futureTick(function () use ($name) {
286287 echo "hello $name\n";
287288 });
288289}
289290
290- hello('Tester');
291+ hello('Tester', $loop );
291292```
292293
293294Unlike timers, tick callbacks are guaranteed to be executed in the order
0 commit comments