11<?php
2+
23namespace Codeception \Lib \Connector ;
34
5+ use InvalidArgumentException ;
6+ use Symfony \Component \DependencyInjection \ContainerInterface ;
7+ use Symfony \Component \HttpFoundation \Request ;
8+ use Symfony \Component \HttpFoundation \Response ;
49use Symfony \Component \HttpKernel \HttpKernelBrowser ;
10+ use Symfony \Component \HttpKernel \Kernel ;
511
6- //Alias for Symfony < 4.3
7- if (!class_exists ('Symfony\Component\HttpKernel\HttpKernelBrowser ' ) && class_exists ('Symfony\Component\HttpKernel\Client ' )) {
12+ if (Kernel::VERSION_ID < 40300 ) {
813 class_alias ('Symfony\Component\HttpKernel\Client ' , 'Symfony\Component\HttpKernel\HttpKernelBrowser ' );
914}
1015
1116class Symfony extends HttpKernelBrowser
1217{
1318 /**
14- * @var boolean
19+ * @var bool
1520 */
1621 private $ rebootable = true ;
1722
1823 /**
19- * @var boolean
24+ * @var bool
2025 */
2126 private $ hasPerformedRequest = false ;
2227
2328 /**
24- * @var \Symfony\Component\DependencyInjection\ ContainerInterface
29+ * @var ContainerInterface
2530 */
2631 private $ container = null ;
2732
@@ -33,11 +38,11 @@ class Symfony extends HttpKernelBrowser
3338 /**
3439 * Constructor.
3540 *
36- * @param \Symfony\Component\HttpKernel\ Kernel $kernel A booted HttpKernel instance
37- * @param array $services An injected services
38- * @param boolean $rebootable
41+ * @param Kernel $kernel A booted HttpKernel instance
42+ * @param array $services An injected services
43+ * @param bool $rebootable
3944 */
40- public function __construct (\ Symfony \ Component \ HttpKernel \ Kernel $ kernel , array $ services = [], $ rebootable = true )
45+ public function __construct (Kernel $ kernel , array $ services = [], $ rebootable = true )
4146 {
4247 parent ::__construct ($ kernel );
4348 $ this ->followRedirects (true );
@@ -48,7 +53,8 @@ public function __construct(\Symfony\Component\HttpKernel\Kernel $kernel, array
4853 }
4954
5055 /**
51- * @param \Symfony\Component\HttpFoundation\Request $request
56+ * @param Request $request
57+ * @return Response
5258 */
5359 protected function doRequest ($ request )
5460 {
@@ -86,7 +92,7 @@ public function rebootKernel()
8692 foreach ($ this ->persistentServices as $ serviceName => $ service ) {
8793 try {
8894 $ this ->container ->set ($ serviceName , $ service );
89- } catch (\ InvalidArgumentException $ e ) {
95+ } catch (InvalidArgumentException $ e ) {
9096 //Private services can't be set in Symfony 4
9197 codecept_debug ("[Symfony] Can't set persistent service $ serviceName: " . $ e ->getMessage ());
9298 }
0 commit comments