@@ -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
@@ -469,7 +469,7 @@ run the event loop until there are no more tasks to perform.
469469
470470For many applications, this method is the only directly visible
471471invocation on the event loop.
472- As a rule of thumb, it is usally recommended to attach everything to the
472+ As a rule of thumb, it is usually recommended to attach everything to the
473473same loop instance and then run the loop once at the bottom end of the
474474application.
475475
@@ -487,7 +487,7 @@ run it will result in the application exiting without actually waiting
487487for any of the attached listeners.
488488
489489This method MUST NOT be called while the loop is already running.
490- This method MAY be called more than once after it has explicity been
490+ This method MAY be called more than once after it has explicitly been
491491[ ` stop() ` ped] ( #stop ) or after it automatically stopped because it
492492previously did no longer have anything to do.
493493
@@ -516,18 +516,21 @@ on a loop instance that has already been stopped has no effect.
516516The ` addTimer(float $interval, callable $callback): TimerInterface ` method can be used to
517517enqueue a callback to be invoked once after the given interval.
518518
519- The timer callback function MUST be able to accept a single parameter,
520- the timer instance as also returned by this method or you MAY use a
521- function which has no parameters at all.
519+ The second parameter MUST be a timer callback function that accepts
520+ the timer instance as its only parameter.
521+ If you don't use the timer instance inside your timer callback function
522+ you MAY use a function which has no parameters at all.
522523
523524The timer callback function MUST NOT throw an ` Exception ` .
524525The return value of the timer callback function will be ignored and has
525526no effect, so for performance reasons you're recommended to not return
526527any excessive data structures.
527528
529+ This method returns a timer instance. The same timer instance will also be
530+ passed into the timer callback function as described above.
531+ You can invoke [ ` cancelTimer ` ] ( #canceltimer ) to cancel a pending timer.
528532Unlike [ ` addPeriodicTimer() ` ] ( #addperiodictimer ) , this method will ensure
529533the callback will be invoked only once after the given interval.
530- You can invoke [ ` cancelTimer ` ] ( #canceltimer ) to cancel a pending timer.
531534
532535``` php
533536$loop->addTimer(0.8, function () {
@@ -582,18 +585,21 @@ See also [event loop implementations](#loop-implementations) for more details.
582585The ` addPeriodicTimer(float $interval, callable $callback): TimerInterface ` method can be used to
583586enqueue a callback to be invoked repeatedly after the given interval.
584587
585- The timer callback function MUST be able to accept a single parameter,
586- the timer instance as also returned by this method or you MAY use a
587- function which has no parameters at all.
588+ The second parameter MUST be a timer callback function that accepts
589+ the timer instance as its only parameter.
590+ If you don't use the timer instance inside your timer callback function
591+ you MAY use a function which has no parameters at all.
588592
589593The timer callback function MUST NOT throw an ` Exception ` .
590594The return value of the timer callback function will be ignored and has
591595no effect, so for performance reasons you're recommended to not return
592596any excessive data structures.
593597
594- Unlike [ ` addTimer() ` ] ( #addtimer ) , this method will ensure the the
595- callback will be invoked infinitely after the given interval or until you
596- invoke [ ` cancelTimer ` ] ( #canceltimer ) .
598+ This method returns a timer instance. The same timer instance will also be
599+ passed into the timer callback function as described above.
600+ Unlike [ ` addTimer() ` ] ( #addtimer ) , this method will ensure the callback
601+ will be invoked infinitely after the given interval or until you invoke
602+ [ ` cancelTimer ` ] ( #canceltimer ) .
597603
598604``` php
599605$timer = $loop->addPeriodicTimer(0.1, function () {
@@ -721,9 +727,10 @@ register a listener to be notified when a signal has been caught by this process
721727This is useful to catch user interrupt signals or shutdown signals from
722728tools like ` supervisor ` or ` systemd ` .
723729
724- The listener callback function MUST be able to accept a single parameter,
725- the signal added by this method or you MAY use a function which
726- has no parameters at all.
730+ The second parameter MUST be a listener callback function that accepts
731+ the signal as its only parameter.
732+ If you don't use the signal inside your listener callback function
733+ you MAY use a function which has no parameters at all.
727734
728735The listener callback function MUST NOT throw an ` Exception ` .
729736The return value of the listener callback function will be ignored and has
@@ -738,14 +745,14 @@ $loop->addSignal(SIGINT, function (int $signal) {
738745
739746See also [ example #4 ] ( examples ) .
740747
741- Signaling is only available on Unix-like platform , Windows isn't
748+ Signaling is only available on Unix-like platforms , Windows isn't
742749supported due to operating system limitations.
743750This method may throw a ` BadMethodCallException ` if signals aren't
744751supported on this platform, for example when required extensions are
745752missing.
746753
747754** Note: A listener can only be added once to the same signal, any
748- attempts to add it more then once will be ignored.**
755+ attempts to add it more than once will be ignored.**
749756
750757#### removeSignal()
751758
@@ -776,9 +783,10 @@ react to this event with a single listener and then dispatch from this
776783listener. This method MAY throw an ` Exception ` if the given resource type
777784is not supported by this loop implementation.
778785
779- The listener callback function MUST be able to accept a single parameter,
780- the stream resource added by this method or you MAY use a function which
781- has no parameters at all.
786+ The second parameter MUST be a listener callback function that accepts
787+ the stream resource as its only parameter.
788+ If you don't use the stream resource inside your listener callback function
789+ you MAY use a function which has no parameters at all.
782790
783791The listener callback function MUST NOT throw an ` Exception ` .
784792The return value of the listener callback function will be ignored and has
@@ -828,9 +836,10 @@ react to this event with a single listener and then dispatch from this
828836listener. This method MAY throw an ` Exception ` if the given resource type
829837is not supported by this loop implementation.
830838
831- The listener callback function MUST be able to accept a single parameter,
832- the stream resource added by this method or you MAY use a function which
833- has no parameters at all.
839+ The second parameter MUST be a listener callback function that accepts
840+ the stream resource as its only parameter.
841+ If you don't use the stream resource inside your listener callback function
842+ you MAY use a function which has no parameters at all.
834843
835844The listener callback function MUST NOT throw an ` Exception ` .
836845The return value of the listener callback function will be ignored and has
@@ -872,7 +881,7 @@ to remove a stream that was never added or is invalid has no effect.
872881
873882## Install
874883
875- The recommended way to install this library is [ through Composer] ( https://getcomposer.org ) .
884+ The recommended way to install this library is [ through Composer] ( https://getcomposer.org/ ) .
876885[ New to Composer?] ( https://getcomposer.org/doc/00-intro.md )
877886
878887This project follows [ SemVer] ( https://semver.org/ ) .
@@ -895,7 +904,7 @@ See also [event loop implementations](#loop-implementations) for more details.
895904## Tests
896905
897906To run the test suite, you first need to clone this repo and then install all
898- dependencies [ through Composer] ( https://getcomposer.org ) :
907+ dependencies [ through Composer] ( https://getcomposer.org/ ) :
899908
900909``` bash
901910$ composer install
@@ -904,7 +913,7 @@ $ composer install
904913To run the test suite, go to the project root and run:
905914
906915``` bash
907- $ php vendor/bin/phpunit
916+ $ vendor/bin/phpunit
908917```
909918
910919## License
0 commit comments