From b3742ec493c37b597e507b2eeaf12bb5c7fca794 Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Sun, 15 Dec 2019 22:30:08 +0100 Subject: [PATCH] CS --- .../Authorization/AccessDecisionManager.php | 43 ++++++------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php b/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php index 82e7cd459f..aefd111b29 100644 --- a/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php +++ b/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php @@ -86,17 +86,13 @@ class AccessDecisionManager implements AccessDecisionManagerInterface $deny = 0; foreach ($this->voters as $voter) { $result = $this->vote($voter, $token, $object, $attributes); - switch ($result) { - case VoterInterface::ACCESS_GRANTED: - return true; - case VoterInterface::ACCESS_DENIED: - ++$deny; + if (VoterInterface::ACCESS_GRANTED === $result) { + return true; + } - break; - - default: - break; + if (VoterInterface::ACCESS_DENIED === $result) { + ++$deny; } } @@ -128,16 +124,10 @@ class AccessDecisionManager implements AccessDecisionManagerInterface foreach ($this->voters as $voter) { $result = $this->vote($voter, $token, $object, $attributes); - switch ($result) { - case VoterInterface::ACCESS_GRANTED: - ++$grant; - - break; - - case VoterInterface::ACCESS_DENIED: - ++$deny; - - break; + if (VoterInterface::ACCESS_GRANTED === $result) { + ++$grant; + } elseif (VoterInterface::ACCESS_DENIED === $result) { + ++$deny; } } @@ -169,17 +159,12 @@ class AccessDecisionManager implements AccessDecisionManagerInterface foreach ($attributes as $attribute) { $result = $this->vote($voter, $token, $object, [$attribute]); - switch ($result) { - case VoterInterface::ACCESS_GRANTED: - ++$grant; + if (VoterInterface::ACCESS_DENIED === $result) { + return false; + } - break; - - case VoterInterface::ACCESS_DENIED: - return false; - - default: - break; + if (VoterInterface::ACCESS_GRANTED === $result) { + ++$grant; } } }