Skip to content

Commit c7a7ed1

Browse files
Use ??= more
1 parent 23e3d44 commit c7a7ed1

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

Controller/AbstractController.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,7 @@ protected function renderView(string $view, array $parameters = []): string
251251
protected function render(string $view, array $parameters = [], Response $response = null): Response
252252
{
253253
$content = $this->renderView($view, $parameters);
254-
255-
if (null === $response) {
256-
$response = new Response();
257-
}
254+
$response ??= new Response();
258255

259256
if (200 === $response->getStatusCode()) {
260257
foreach ($parameters as $v) {

Controller/RedirectController.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ public function urlRedirectAction(Request $request, string $path, bool $permanen
124124
return new RedirectResponse($path, $statusCode);
125125
}
126126

127-
if (null === $scheme) {
128-
$scheme = $request->getScheme();
129-
}
127+
$scheme ??= $request->getScheme();
130128

131129
if ($qs = $request->server->get('QUERY_STRING') ?: $request->getQueryString()) {
132130
if (!str_contains($path, '?')) {

Test/KernelTestCase.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ protected static function getContainer(): ContainerInterface
110110
*/
111111
protected static function createKernel(array $options = []): KernelInterface
112112
{
113-
if (null === static::$class) {
114-
static::$class = static::getKernelClass();
115-
}
113+
static::$class ??= static::getKernelClass();
116114

117115
if (isset($options['environment'])) {
118116
$env = $options['environment'];

0 commit comments

Comments
 (0)