File tree Expand file tree Collapse file tree 4 files changed +16
-1
lines changed Expand file tree Collapse file tree 4 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ You should use the [`Factory`](#factory) to automatically create a new instance.
149
149
Advanced! If you explicitly need a certain event loop implementation, you can
150
150
manually instantiate one of the following classes.
151
151
Note that you may have to install the required PHP extensions for the respective
152
- event loop implementation first or this may result in a fatal error .
152
+ event loop implementation first or they will throw a ` BadMethodCallException ` on creation .
153
153
154
154
#### StreamSelectLoop
155
155
Original file line number Diff line number Diff line change 2
2
3
3
namespace React \EventLoop ;
4
4
5
+ use BadMethodCallException ;
5
6
use Event ;
6
7
use EventBase ;
7
8
use EventConfig as EventBaseConfig ;
@@ -38,6 +39,10 @@ final class ExtEventLoop implements LoopInterface
38
39
39
40
public function __construct ()
40
41
{
42
+ if (!class_exists ('EventBase ' , false )) {
43
+ throw new BadMethodCallException ('Cannot create ExtEventLoop, ext-event extension missing ' );
44
+ }
45
+
41
46
$ config = new EventBaseConfig ();
42
47
$ config ->requireFeatures (EventBaseConfig::FEATURE_FDS );
43
48
Original file line number Diff line number Diff line change 2
2
3
3
namespace React \EventLoop ;
4
4
5
+ use BadMethodCallException ;
5
6
use libev \EventLoop ;
6
7
use libev \IOEvent ;
7
8
use libev \SignalEvent ;
@@ -36,6 +37,10 @@ final class ExtLibevLoop implements LoopInterface
36
37
37
38
public function __construct ()
38
39
{
40
+ if (!class_exists ('libev\EventLoop ' , false )) {
41
+ throw new BadMethodCallException ('Cannot create ExtLibevLoop, ext-libev extension missing ' );
42
+ }
43
+
39
44
$ this ->loop = new EventLoop ();
40
45
$ this ->futureTickQueue = new FutureTickQueue ();
41
46
$ this ->timerEvents = new SplObjectStorage ();
Original file line number Diff line number Diff line change 2
2
3
3
namespace React \EventLoop ;
4
4
5
+ use BadMethodCallException ;
5
6
use Event ;
6
7
use EventBase ;
7
8
use React \EventLoop \Tick \FutureTickQueue ;
@@ -52,6 +53,10 @@ final class ExtLibeventLoop implements LoopInterface
52
53
53
54
public function __construct ()
54
55
{
56
+ if (!function_exists ('event_base_new ' )) {
57
+ throw new BadMethodCallException ('Cannot create ExtLibeventLoop, ext-libevent extension missing ' );
58
+ }
59
+
55
60
$ this ->eventBase = event_base_new ();
56
61
$ this ->futureTickQueue = new FutureTickQueue ();
57
62
$ this ->timerEvents = new SplObjectStorage ();
You can’t perform that action at this time.
0 commit comments