From 17a880b4c98fbc618e8c1164913af7f965258d5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCcher?= Date: Fri, 6 May 2022 08:34:23 +0200 Subject: [PATCH] Replace deprecated KernelEvent::isMasterRequest() (#7) --- Listener/ResponseListener.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Listener/ResponseListener.php b/Listener/ResponseListener.php index 42dc723..00a2752 100644 --- a/Listener/ResponseListener.php +++ b/Listener/ResponseListener.php @@ -41,12 +41,17 @@ public static function getSubscribedEvents(): array public function onKernelResponse(KernelResponseEvent $event): void { - if (! $event->isMasterRequest()) { + if (! $this->isMainRequest($event)) { return; } $this->interactor->addContextFromConfig(); } + + private function isMainRequest(KernelResponseEvent $event): bool + { + return method_exists($event, 'isMainRequest') ? $event->isMainRequest() : $event->isMasterRequest(); + } } if (! \class_exists(KernelResponseEvent::class)) {