3232 */
3333abstract class TestKernel extends Kernel
3434{
35- protected $ bundleSets = [];
35+ protected array $ bundleSets = [];
3636
37- protected $ requiredBundles = [];
37+ protected array $ requiredBundles = [];
3838
3939 /**
4040 * Register commonly needed bundle sets and then
4141 * after initializing the parent kernel, let the
4242 * concrete kernel configure itself using the abstracvt
4343 * configure() command.
4444 */
45- public function __construct ($ env , $ debug )
45+ public function __construct (string $ env , bool $ debug )
4646 {
4747 $ defaultBundles = [
4848 FrameworkBundle::class,
@@ -72,23 +72,25 @@ public function __construct($env, $debug)
7272 * $this->addBundle(new MyBundle);
7373 * $this->addBundles(array(new Bundle1, new Bundle2));
7474 */
75- abstract protected function configure ();
75+ abstract protected function configure (): void ;
7676
7777 /**
7878 * Register a set of bundles with the given name.
7979 *
8080 * This method does not add the bundles to the kernel,
8181 * it just makes a set available.
8282 */
83- public function registerBundleSet ($ name , $ bundles )
83+ public function registerBundleSet (string $ name , array $ bundles ): void
8484 {
8585 $ this ->bundleSets [$ name ] = $ bundles ;
8686 }
8787
8888 /**
8989 * The bundles in the named sets will be added to the Kernel.
90+ *
91+ * @param string[] $names
9092 */
91- public function requireBundleSets (array $ names )
93+ public function requireBundleSets (array $ names ): void
9294 {
9395 foreach ($ names as $ name ) {
9496 $ this ->requireBundleSet ($ name );
@@ -102,7 +104,7 @@ public function requireBundleSets(array $names)
102104 * This enables us to declare pre-defined bundle sets without
103105 * worrying if the bundle is actually present or not.
104106 */
105- public function requireBundleSet ($ name )
107+ public function requireBundleSet (string $ name ): void
106108 {
107109 if (!isset ($ this ->bundleSets [$ name ])) {
108110 throw new \InvalidArgumentException (sprintf (
@@ -127,7 +129,7 @@ public function requireBundleSet($name)
127129 /**
128130 * Add concrete bundles to the kernel.
129131 */
130- public function addBundles (array $ bundles )
132+ public function addBundles (array $ bundles ): void
131133 {
132134 foreach ($ bundles as $ bundle ) {
133135 $ this ->addBundle ($ bundle );
@@ -137,7 +139,7 @@ public function addBundles(array $bundles)
137139 /**
138140 * Add a concrete bundle to the kernel.
139141 */
140- public function addBundle (BundleInterface $ bundle )
142+ public function addBundle (BundleInterface $ bundle ): void
141143 {
142144 $ this ->requiredBundles [] = $ bundle ;
143145 }
@@ -153,28 +155,22 @@ public function registerBundles(): iterable
153155 }
154156
155157 /**
156- * Returns the KernelDir of the CHILD class,
158+ * Returns the project directory of the CHILD class,
157159 * i.e. the concrete implementation in the bundles
158160 * src/ directory (or wherever).
159161 */
160- public function getKernelDir ()
161- {
162- return $ this ->getProjectDir ();
163- }
164-
165162 public function getProjectDir (): string
166163 {
167164 $ refl = new \ReflectionClass ($ this );
168165 $ fname = $ refl ->getFileName ();
169- $ kernelDir = \dirname ($ fname );
170166
171- return $ kernelDir ;
167+ return \dirname ( $ fname ) ;
172168 }
173169
174170 public function getCacheDir (): string
175171 {
176172 return implode ('/ ' , [
177- $ this ->getKernelDir (),
173+ $ this ->getProjectDir (),
178174 'var ' ,
179175 'cache ' ,
180176 ]);
@@ -192,7 +188,7 @@ public function getLogDir(): string
192188 /**
193189 * Registers the bundles defined in config/bundles.php.
194190 */
195- protected function registerConfiguredBundles ()
191+ protected function registerConfiguredBundles (): void
196192 {
197193 $ bundleFilePath = $ this ->getKernelDir ().'/config/bundles.php ' ;
198194 if (!file_exists ($ bundleFilePath )) {
0 commit comments