Refactored TrustHostsTest; Added return types to TrustHosts

This commit is contained in:
Constantin Graf
2026-08-06 16:58:43 +02:00
committed by Gregor Vostrak
parent 80d98b30a1
commit f6d886b218
3 changed files with 273 additions and 166 deletions

View File

@@ -19,7 +19,7 @@ class TrustHosts extends BaseTrustHosts
/**
* @return array<int, string|null>
*/
public function hosts()
public function hosts(): array
{
/** @var array<int, string> $configured */
$configured = config('app.trusted_hosts', []);
@@ -40,9 +40,8 @@ class TrustHosts extends BaseTrustHosts
/**
* @param \Closure(Request): Response $next
* @return Response
*/
public function handle(Request $request, $next)
public function handle(Request $request, $next): Response
{
// Exempt health checks (probed by IP). Also reset the trusted hosts,
// since Octane leaks the static state across requests.