@@ -351,7 +351,7 @@ event loop implementation first or they will throw a `BadMethodCallException` on
351351A ` stream_select() ` based event loop.
352352
353353This uses the [ ` stream_select() ` ] ( https://www.php.net/manual/en/function.stream-select.php )
354- function and is the only implementation which works out of the box with PHP.
354+ function and is the only implementation that works out of the box with PHP.
355355
356356This event loop works out of the box on PHP 5.3 through PHP 7+ and HHVM.
357357This means that no installation is required and this library works on all
@@ -468,7 +468,7 @@ run the event loop until there are no more tasks to perform.
468468
469469For many applications, this method is the only directly visible
470470invocation on the event loop.
471- As a rule of thumb, it is usally recommended to attach everything to the
471+ As a rule of thumb, it is usually recommended to attach everything to the
472472same loop instance and then run the loop once at the bottom end of the
473473application.
474474
@@ -486,7 +486,7 @@ run it will result in the application exiting without actually waiting
486486for any of the attached listeners.
487487
488488This method MUST NOT be called while the loop is already running.
489- This method MAY be called more than once after it has explicity been
489+ This method MAY be called more than once after it has explicitly been
490490[ ` stop() ` ped] ( #stop ) or after it automatically stopped because it
491491previously did no longer have anything to do.
492492
@@ -515,18 +515,21 @@ on a loop instance that has already been stopped has no effect.
515515The ` addTimer(float $interval, callable $callback): TimerInterface ` method can be used to
516516enqueue a callback to be invoked once after the given interval.
517517
518- The timer callback function MUST be able to accept a single parameter,
519- the timer instance as also returned by this method or you MAY use a
520- function which has no parameters at all.
518+ The second parameter MUST be a timer callback function that accepts
519+ the timer instance as its only parameter.
520+ If you don't use the timer instance inside your timer callback function
521+ you MAY use a function which has no parameters at all.
521522
522523The timer callback function MUST NOT throw an ` Exception ` .
523524The return value of the timer callback function will be ignored and has
524525no effect, so for performance reasons you're recommended to not return
525526any excessive data structures.
526527
528+ This method returns a timer instance. The same timer instance will also be
529+ passed into the timer callback function as described above.
530+ You can invoke [ ` cancelTimer ` ] ( #canceltimer ) to cancel a pending timer.
527531Unlike [ ` addPeriodicTimer() ` ] ( #addperiodictimer ) , this method will ensure
528532the callback will be invoked only once after the given interval.
529- You can invoke [ ` cancelTimer ` ] ( #canceltimer ) to cancel a pending timer.
530533
531534``` php
532535$loop->addTimer(0.8, function () {
@@ -581,15 +584,18 @@ See also [event loop implementations](#loop-implementations) for more details.
581584The ` addPeriodicTimer(float $interval, callable $callback): TimerInterface ` method can be used to
582585enqueue a callback to be invoked repeatedly after the given interval.
583586
584- The timer callback function MUST be able to accept a single parameter,
585- the timer instance as also returned by this method or you MAY use a
586- function which has no parameters at all.
587+ The second parameter MUST be a timer callback function that accepts
588+ the timer instance as its only parameter.
589+ If you don't use the timer instance inside your timer callback function
590+ you MAY use a function which has no parameters at all.
587591
588592The timer callback function MUST NOT throw an ` Exception ` .
589593The return value of the timer callback function will be ignored and has
590594no effect, so for performance reasons you're recommended to not return
591595any excessive data structures.
592596
597+ This method returns a timer instance. The same timer instance will also be
598+ passed into the timer callback function as described above.
593599Unlike [ ` addTimer() ` ] ( #addtimer ) , this method will ensure the callback
594600will be invoked infinitely after the given interval or until you invoke
595601[ ` cancelTimer ` ] ( #canceltimer ) .
@@ -720,9 +726,10 @@ register a listener to be notified when a signal has been caught by this process
720726This is useful to catch user interrupt signals or shutdown signals from
721727tools like ` supervisor ` or ` systemd ` .
722728
723- The listener callback function MUST be able to accept a single parameter,
724- the signal added by this method or you MAY use a function which
725- has no parameters at all.
729+ The second parameter MUST be a listener callback function that accepts
730+ the signal as its only parameter.
731+ If you don't use the signal inside your listener callback function
732+ you MAY use a function which has no parameters at all.
726733
727734The listener callback function MUST NOT throw an ` Exception ` .
728735The return value of the listener callback function will be ignored and has
@@ -737,14 +744,14 @@ $loop->addSignal(SIGINT, function (int $signal) {
737744
738745See also [ example #4 ] ( examples ) .
739746
740- Signaling is only available on Unix-like platform , Windows isn't
747+ Signaling is only available on Unix-like platforms , Windows isn't
741748supported due to operating system limitations.
742749This method may throw a ` BadMethodCallException ` if signals aren't
743750supported on this platform, for example when required extensions are
744751missing.
745752
746753** Note: A listener can only be added once to the same signal, any
747- attempts to add it more then once will be ignored.**
754+ attempts to add it more than once will be ignored.**
748755
749756#### removeSignal()
750757
@@ -775,9 +782,10 @@ react to this event with a single listener and then dispatch from this
775782listener. This method MAY throw an ` Exception ` if the given resource type
776783is not supported by this loop implementation.
777784
778- The listener callback function MUST be able to accept a single parameter,
779- the stream resource added by this method or you MAY use a function which
780- has no parameters at all.
785+ The second parameter MUST be a listener callback function that accepts
786+ the stream resource as its only parameter.
787+ If you don't use the stream resource inside your listener callback function
788+ you MAY use a function which has no parameters at all.
781789
782790The listener callback function MUST NOT throw an ` Exception ` .
783791The return value of the listener callback function will be ignored and has
@@ -827,9 +835,10 @@ react to this event with a single listener and then dispatch from this
827835listener. This method MAY throw an ` Exception ` if the given resource type
828836is not supported by this loop implementation.
829837
830- The listener callback function MUST be able to accept a single parameter,
831- the stream resource added by this method or you MAY use a function which
832- has no parameters at all.
838+ The second parameter MUST be a listener callback function that accepts
839+ the stream resource as its only parameter.
840+ If you don't use the stream resource inside your listener callback function
841+ you MAY use a function which has no parameters at all.
833842
834843The listener callback function MUST NOT throw an ` Exception ` .
835844The return value of the listener callback function will be ignored and has
@@ -871,7 +880,7 @@ to remove a stream that was never added or is invalid has no effect.
871880
872881## Install
873882
874- The recommended way to install this library is [ through Composer] ( https://getcomposer.org ) .
883+ The recommended way to install this library is [ through Composer] ( https://getcomposer.org/ ) .
875884[ New to Composer?] ( https://getcomposer.org/doc/00-intro.md )
876885
877886This project follows [ SemVer] ( https://semver.org/ ) .
@@ -894,7 +903,7 @@ See also [event loop implementations](#loop-implementations) for more details.
894903## Tests
895904
896905To run the test suite, you first need to clone this repo and then install all
897- dependencies [ through Composer] ( https://getcomposer.org ) :
906+ dependencies [ through Composer] ( https://getcomposer.org/ ) :
898907
899908``` bash
900909$ composer install
@@ -903,7 +912,7 @@ $ composer install
903912To run the test suite, go to the project root and run:
904913
905914``` bash
906- $ php vendor/bin/phpunit
915+ $ vendor/bin/phpunit
907916```
908917
909918## License
0 commit comments