Skip to content

Commit d92db3f

Browse files
Merge branch '4.4' into 5.0
* 4.4: (21 commits) fix merge CS [FrameworkBundle][ContainerLintCommand] Improve messages when the kernel or the container is not supported [Serializer] Skip uninitialized (PHP 7.4) properties in PropertyNormalizer and ObjectNormalizer stop using deprecated Doctrine persistence classes [Cache] Fix wrong classname in deprecation message Fix regex lookahead syntax in ApplicationTest Fixed syntax in comment [SecurityBundle][FirewallMap] Remove unused property [Messenger][AMQP] Use delivery_mode=2 by default [FrameworkBundle][DependencyInjection] Skip removed ids in the lint container command and its associated pass [SECURITY] Revert "AbstractAuthenticationListener.php error instead info. Rebase of #28462" [FrameworkBundle][Secrets] Hook configured local dotenv file [DI] Improve performance of processDefinition fix redis multi host dsn not recognized fix constructor argument type declaration Fix invalid Windows path normalization [Validator][ConstraintValidator] Safe fail on invalid timezones [DoctrineBridge] Fixed submitting invalid ids when using queries with limit [FrameworkBundle] Add info & example to auto_mapping config ...
2 parents 1b11cce + 9c7f8f2 commit d92db3f

File tree

1 file changed

+14
-29
lines changed

1 file changed

+14
-29
lines changed

Authorization/AccessDecisionManager.php

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,13 @@ private function decideAffirmative(TokenInterface $token, array $attributes, $ob
7676
$deny = 0;
7777
foreach ($this->voters as $voter) {
7878
$result = $voter->vote($token, $object, $attributes);
79-
switch ($result) {
80-
case VoterInterface::ACCESS_GRANTED:
81-
return true;
8279

83-
case VoterInterface::ACCESS_DENIED:
84-
++$deny;
85-
86-
break;
80+
if (VoterInterface::ACCESS_GRANTED === $result) {
81+
return true;
82+
}
8783

88-
default:
89-
break;
84+
if (VoterInterface::ACCESS_DENIED === $result) {
85+
++$deny;
9086
}
9187
}
9288

@@ -118,16 +114,10 @@ private function decideConsensus(TokenInterface $token, array $attributes, $obje
118114
foreach ($this->voters as $voter) {
119115
$result = $voter->vote($token, $object, $attributes);
120116

121-
switch ($result) {
122-
case VoterInterface::ACCESS_GRANTED:
123-
++$grant;
124-
125-
break;
126-
127-
case VoterInterface::ACCESS_DENIED:
128-
++$deny;
129-
130-
break;
117+
if (VoterInterface::ACCESS_GRANTED === $result) {
118+
++$grant;
119+
} elseif (VoterInterface::ACCESS_DENIED === $result) {
120+
++$deny;
131121
}
132122
}
133123

@@ -159,17 +149,12 @@ private function decideUnanimous(TokenInterface $token, array $attributes, $obje
159149
foreach ($attributes as $attribute) {
160150
$result = $voter->vote($token, $object, [$attribute]);
161151

162-
switch ($result) {
163-
case VoterInterface::ACCESS_GRANTED:
164-
++$grant;
165-
166-
break;
167-
168-
case VoterInterface::ACCESS_DENIED:
169-
return false;
152+
if (VoterInterface::ACCESS_DENIED === $result) {
153+
return false;
154+
}
170155

171-
default:
172-
break;
156+
if (VoterInterface::ACCESS_GRANTED === $result) {
157+
++$grant;
173158
}
174159
}
175160
}

0 commit comments

Comments
 (0)