From 667a22c5dced04c9c84a68560237c50f9db8eaea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Mon, 30 Oct 2023 15:32:40 +0100 Subject: [PATCH] frankenphp-symfony: tiny refactoring --- src/frankenphp-symfony/src/Runner.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/frankenphp-symfony/src/Runner.php b/src/frankenphp-symfony/src/Runner.php index 0de2c89..6c6cbe9 100644 --- a/src/frankenphp-symfony/src/Runner.php +++ b/src/frankenphp-symfony/src/Runner.php @@ -22,16 +22,15 @@ public function __construct(private HttpKernelInterface $kernel) public function run(): int { - $kernel = $this->kernel; $server = array_filter($_SERVER, static fn (string $key) => !str_starts_with($key, 'HTTP_'), ARRAY_FILTER_USE_KEY); $server['APP_RUNTIME_MODE'] = 'web=1&worker=1'; - $handler = static function () use ($kernel, $server, &$sfRequest, &$sfResponse): void { - // Merge the environment variables coming from DotEnv with the ones tied to the current request + $handler = function () use ($server, &$sfRequest, &$sfResponse): void { + // Merge the environment variables coming from DotEnv with the ones tight to the current request $_SERVER += $server; $sfRequest = Request::createFromGlobals(); - $sfResponse = $kernel->handle($sfRequest); + $sfResponse = $this->kernel->handle($sfRequest); $sfResponse->send(); }; @@ -39,8 +38,8 @@ public function run(): int do { $ret = \frankenphp_handle_request($handler); - if ($kernel instanceof TerminableInterface && $sfRequest && $sfResponse) { - $kernel->terminate($sfRequest, $sfResponse); + if ($this->kernel instanceof TerminableInterface && $sfRequest && $sfResponse) { + $this->kernel->terminate($sfRequest, $sfResponse); } gc_collect_cycles();