diff --git a/src/React/Espresso/Stack.php b/src/React/Espresso/Stack.php index 93ac52d..c7a1663 100644 --- a/src/React/Espresso/Stack.php +++ b/src/React/Espresso/Stack.php @@ -22,7 +22,7 @@ public function __construct($app) return new HttpServer($stack['socket']); }); - $isFactory = is_object($app) && method_exists($app, '__invoke'); + $isFactory = is_callable($app); $this['app'] = $isFactory ? $this->protectService($app) : $app; }