Skip to content

Commit 6fb6c8b

Browse files
committed
use null coalesce operator
1 parent e98460d commit 6fb6c8b

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/Listener/ForceHttps.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,8 @@ public function forceHttpsScheme(MvcEvent $e) : void
9090
}
9191
}
9292

93-
if (! isset($httpsRequestUri)) {
94-
$uriString = $uri->setScheme('https')->toString();
95-
$httpsRequestUri = $this->getFinalhttpsRequestUri($uriString);
96-
}
93+
$httpsRequestUri = $httpsRequestUri
94+
?? $this->getFinalhttpsRequestUri((string) $uri->setScheme('https'));
9795

9896
// 308 keeps headers, request method, and request body
9997
$response->setStatusCode(308);

src/Middleware/ForceHttps.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,8 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
7373
}
7474
}
7575

76-
if (! isset($httpsRequestUri)) {
77-
$uriString = $uri->withScheme('https')->__toString();
78-
$httpsRequestUri = $this->getFinalhttpsRequestUri($uriString);
79-
}
76+
$httpsRequestUri = $httpsRequestUri
77+
?? $this->getFinalhttpsRequestUri((string) $uri->withScheme('https'));
8078

8179
// 308 keeps headers, request method, and request body
8280
$response = $response->withStatus(308);

0 commit comments

Comments
 (0)