@@ -31,7 +31,7 @@ public function __construct(
31
31
parent ::__construct ($ kernel );
32
32
$ this ->followRedirects ();
33
33
$ this ->container = $ this ->getContainer ();
34
- $ this ->rebootKernel (); // Ensure the profiler exists
34
+ $ this ->rebootKernel ();
35
35
}
36
36
37
37
/** @param Request $request */
@@ -47,7 +47,7 @@ protected function doRequest(object $request): Response
47
47
}
48
48
49
49
/**
50
- * Reboot kernel
50
+ * Reboots the kernel.
51
51
*
52
52
* Services from the list of persistent services
53
53
* are updated from service container before kernel shutdown
@@ -64,8 +64,7 @@ public function rebootKernel(): void
64
64
}
65
65
66
66
$ this ->persistDoctrineConnections ();
67
- $ this ->kernel ->boot ();
68
- $ this ->kernel ->shutdown ();
67
+ $ this ->ensureKernelShutdown ();
69
68
$ this ->kernel ->boot ();
70
69
$ this ->container = $ this ->getContainer ();
71
70
@@ -82,6 +81,12 @@ public function rebootKernel(): void
82
81
}
83
82
}
84
83
84
+ protected function ensureKernelShutdown (): void
85
+ {
86
+ $ this ->kernel ->boot ();
87
+ $ this ->kernel ->shutdown ();
88
+ }
89
+
85
90
private function getContainer (): ?ContainerInterface
86
91
{
87
92
/** @var ContainerInterface $container */
@@ -120,7 +125,9 @@ private function persistDoctrineConnections(): void
120
125
}
121
126
122
127
$ reflectedContainer = new ReflectionClass ($ publicContainer );
123
- $ reflectionTarget = $ reflectedContainer ->hasProperty ('parameters ' ) ? $ publicContainer : $ publicContainer ->getParameterBag ();
128
+ $ reflectionTarget = $ reflectedContainer ->hasProperty ('parameters ' )
129
+ ? $ publicContainer
130
+ : $ publicContainer ->getParameterBag ();
124
131
125
132
$ reflectedParameters = new ReflectionProperty ($ reflectionTarget , 'parameters ' );
126
133
$ reflectedParameters ->setAccessible (true );
0 commit comments