File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -54,15 +54,21 @@ public static function execute(callable $callback, LoopDriver $driver = null)
54
54
/**
55
55
* Create a new driver if a factory is present, otherwise throw.
56
56
*
57
- * @throws \LogicException if no factory is set
57
+ * @throws \LogicException if no factory is set or no driver returned from factory
58
58
*/
59
59
private static function createDriver ()
60
60
{
61
61
if (self ::$ factory === null ) {
62
62
throw new \LogicException ("Can't create an event loop driver without a factory. " );
63
63
}
64
64
65
- return self ::$ factory ->create ();
65
+ $ driver = self ::$ factory ->create ();
66
+
67
+ if (!$ driver instanceof LoopDriver) {
68
+ throw new \LogicException ("LoopDriverFactory didn't return a LoopDriver. " );
69
+ }
70
+
71
+ return $ driver ;
66
72
}
67
73
68
74
/**
You can’t perform that action at this time.
0 commit comments