From 7131d5b40b15b48ed879c26de1a433c9a5a356cb Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Mon, 16 Dec 2024 09:18:26 +0100 Subject: [PATCH] Add NelmioSecurityBundle and minor code improvements Included NelmioSecurityBundle in composer dependencies to enhance security features. Simplified import management in PwaRuntime and improved code readability in PwaDevServerSubscriber by adjusting line formatting. These changes aim to improve maintainability and clarity. --- composer.json | 1 + src/Subscriber/PwaDevServerSubscriber.php | 3 ++- src/Twig/PwaRuntime.php | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d2c7326..4f01d6c 100644 --- a/composer.json +++ b/composer.json @@ -53,6 +53,7 @@ "ergebnis/phpunit-slow-test-detector": "^2.14", "infection/infection": "^0.28|^0.29", "matthiasnoback/symfony-config-test": "^5.1", + "nelmio/security-bundle": "^3.0", "php-parallel-lint/php-parallel-lint": "^1.4", "phpstan/extension-installer": "^1.1", "phpstan/phpdoc-parser": "^1.28|^2.0", diff --git a/src/Subscriber/PwaDevServerSubscriber.php b/src/Subscriber/PwaDevServerSubscriber.php index 3ae55d3..df5f936 100644 --- a/src/Subscriber/PwaDevServerSubscriber.php +++ b/src/Subscriber/PwaDevServerSubscriber.php @@ -57,7 +57,8 @@ public function onKernelRequest(RequestEvent $event): void public function onKernelResponse(ResponseEvent $event): void { - $headers = $event->getResponse()->headers; + $headers = $event->getResponse() + ->headers; if ($headers->has('X-Pwa-Dev')) { $event->stopPropagation(); } diff --git a/src/Twig/PwaRuntime.php b/src/Twig/PwaRuntime.php index a97e387..484a0aa 100644 --- a/src/Twig/PwaRuntime.php +++ b/src/Twig/PwaRuntime.php @@ -14,6 +14,7 @@ use Symfony\Component\AssetMapper\MappedAsset; use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\Mime\MimeTypes; +use function array_key_exists; use function sprintf; use const ENT_COMPAT; use const ENT_SUBSTITUTE;