Skip to content

Commit 90092b7

Browse files
IssamRaoufnicolas-grekas
authored andcommitted
Update KernelTestCase.php
Replace Conditional statements by a simple Null Coalescing Operator
1 parent 8b5330e commit 90092b7

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

Test/KernelTestCase.php

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -111,26 +111,9 @@ protected static function getContainer(): ContainerInterface
111111
protected static function createKernel(array $options = []): KernelInterface
112112
{
113113
static::$class ??= static::getKernelClass();
114-
115-
if (isset($options['environment'])) {
116-
$env = $options['environment'];
117-
} elseif (isset($_ENV['APP_ENV'])) {
118-
$env = $_ENV['APP_ENV'];
119-
} elseif (isset($_SERVER['APP_ENV'])) {
120-
$env = $_SERVER['APP_ENV'];
121-
} else {
122-
$env = 'test';
123-
}
124-
125-
if (isset($options['debug'])) {
126-
$debug = $options['debug'];
127-
} elseif (isset($_ENV['APP_DEBUG'])) {
128-
$debug = $_ENV['APP_DEBUG'];
129-
} elseif (isset($_SERVER['APP_DEBUG'])) {
130-
$debug = $_SERVER['APP_DEBUG'];
131-
} else {
132-
$debug = true;
133-
}
114+
115+
$env = $options['environment'] ?? $_ENV['APP_ENV'] ?? $_SERVER['APP_ENV'] ?? 'test';
116+
$debug = $options['debug'] ?? $_ENV['APP_DEBUG'] ?? $_SERVER['APP_DEBUG'] ?? true;
134117

135118
return new static::$class($env, $debug);
136119
}

0 commit comments

Comments
 (0)