8000 minor #51304 [FrameworkBundle] [Test] Replace Conditional statements … · symfony/symfony@7513b48 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7513b48

Browse files
minor #51304 [FrameworkBundle] [Test] Replace Conditional statements by a simple Null Coalescing Operator ,KernelTestCase::createKernel (IssamRaouf)
This PR was submitted for the 6.3 branch but it was merged into the 6.4 branch instead. Discussion ---------- [FrameworkBundle] [Test] Replace Conditional statements by a simple Null Coalescing Operator ,KernelTestCase::createKernel | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Replace Conditional statements by a simple Null Coalescing Operator Commits ------- dd85a16 Update KernelTestCase.php
2 parents 85366b4 + dd85a16 commit 7513b48

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

src/Symfony/Bundle/FrameworkBundle/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)
0