22
33namespace Http \Adapter \React ;
44
5+ use Http \Discovery \MessageFactoryDiscovery ;
56use Psr \Http \Message \ResponseInterface ;
67use React \EventLoop \LoopInterface ;
78use React \Promise \Deferred ;
@@ -38,7 +39,7 @@ class Client implements HttpClient, HttpAsyncClient
3839 private $ loop ;
3940
4041 /**
41- * HttpPlug message factory.
42+ * HTTPlug message factory.
4243 *
4344 * @var MessageFactory
4445 */
@@ -47,12 +48,12 @@ class Client implements HttpClient, HttpAsyncClient
4748 /**
4849 * Initialize the React client.
4950 *
50- * @param MessageFactory $messageFactory
51- * @param LoopInterface|null $loop React Event loop
52- * @param ReactClient $client React client to use
51+ * @param MessageFactory|null $messageFactory
52+ * @param LoopInterface|null $loop React Event loop
53+ * @param ReactClient|null $client React client to use
5354 */
5455 public function __construct (
55- MessageFactory $ messageFactory ,
56+ MessageFactory $ messageFactory = null ,
5657 LoopInterface $ loop = null ,
5758 ReactClient $ client = null
5859 ) {
@@ -64,7 +65,7 @@ public function __construct(
6465 $ this ->loop = (null !== $ loop ) ?: ReactFactory::buildEventLoop ();
6566 $ this ->client = (null !== $ client ) ?: ReactFactory::buildHttpClient ($ this ->loop );
6667
67- $ this ->messageFactory = $ messageFactory ;
68+ $ this ->messageFactory = $ messageFactory ?: MessageFactoryDiscovery:: find () ;
6869 }
6970
7071 /**
0 commit comments