11<?php
2+
3+ declare (strict_types=1 );
4+
25namespace Codeception \Lib \Connector ;
36
47use Codeception \Configuration ;
58use Codeception \Lib \Connector \Mezzio \ResponseCollector ;
9+ use Exception ;
10+ use Interop \Container \ContainerInterface ;
611use Symfony \Component \BrowserKit \AbstractBrowser as Client ;
712use Symfony \Component \BrowserKit \Response ;
813use Symfony \Component \BrowserKit \Request as BrowserKitRequest ;
@@ -23,7 +28,7 @@ class Mezzio extends Client
2328 private $ responseCollector ;
2429
2530 /**
26- * @var \Interop\Container\ ContainerInterface
31+ * @var ContainerInterface
2732 */
2833 private $ container ;
2934
@@ -34,9 +39,7 @@ class Mezzio extends Client
3439
3540 /**
3641 * @param BrowserKitRequest $request
37- *
38- * @return Response
39- * @throws \Exception
42+ * @throws Exception
4043 */
4144 public function doRequest ($ request )
4245 {
@@ -115,7 +118,7 @@ public function doRequest($request)
115118 );
116119 }
117120
118- private function convertFiles (array $ files )
121+ private function convertFiles (array $ files ): array
119122 {
120123 $ fileObjects = [];
121124 foreach ($ files as $ fieldName => $ file ) {
@@ -136,7 +139,7 @@ private function convertFiles(array $files)
136139 return $ fileObjects ;
137140 }
138141
139- private function extractHeaders (BrowserKitRequest $ request )
142+ private function extractHeaders (BrowserKitRequest $ request ): array
140143 {
141144 $ headers = [];
142145 $ server = $ request ->getServer ();
@@ -155,7 +158,7 @@ private function extractHeaders(BrowserKitRequest $request)
155158 return $ headers ;
156159 }
157160
158- public function initApplication ()
161+ public function initApplication (): Application
159162 {
160163 $ cwd = getcwd ();
161164 $ projectDir = Configuration::projectDir ();
@@ -191,7 +194,7 @@ public function initApplication()
191194 return $ app ;
192195 }
193196
194- private function initResponseCollector ()
197+ private function initResponseCollector (): void
195198 {
196199 if (!method_exists ($ this ->application , 'getEmitter ' )) {
197200 //Does not exist in Mezzio v3
@@ -210,21 +213,18 @@ private function initResponseCollector()
210213 $ emitterStack ->unshift ($ this ->responseCollector );
211214 }
212215
213- public function getContainer ()
216+ public function getContainer (): ContainerInterface
214217 {
215218 return $ this ->container ;
216219 }
217220
218- /**
219- * @param Application
220- */
221- public function setApplication (Application $ application )
221+ public function setApplication (Application $ application ): void
222222 {
223223 $ this ->application = $ application ;
224224 $ this ->initResponseCollector ();
225225 }
226226
227- public function setConfig (array $ config )
227+ public function setConfig (array $ config ): void
228228 {
229229 $ this ->config = $ config ;
230230 }
0 commit comments