From 3017880a643dfc678af5fad5ef8310bfd78edd33 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Thu, 10 Mar 2022 22:29:45 +0100 Subject: [PATCH] refactoring of RequestSecurityEventSubscriber --- core/EventSubscriber/RequestSecurityEventSubscriber.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/EventSubscriber/RequestSecurityEventSubscriber.php b/core/EventSubscriber/RequestSecurityEventSubscriber.php index 6b7a934..6eb0b29 100644 --- a/core/EventSubscriber/RequestSecurityEventSubscriber.php +++ b/core/EventSubscriber/RequestSecurityEventSubscriber.php @@ -51,15 +51,13 @@ class RequestSecurityEventSubscriber implements EventSubscriberInterface $isGranted = $this->authorizationChecker->isGranted($role); if ('or' === $operator && $isGranted) { - $isAuthorized = true; + return; } elseif ('and' === $operator && !$isGranted) { throw $exception; } } - if (!$isAuthorized) { - throw $exception; - } + throw $exception; } public static function getSubscribedEvents(): array