Skip to content

Commit 9c7f8f2

Browse files
Merge branch '4.3' into 4.4
* 4.3: fix merge CS [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 [DI] Improve performance of processDefinition 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 fix comparisons with null values at property paths
2 parents c7b8ea7 + 5c5f078 commit 9c7f8f2

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
@@ -75,17 +75,13 @@ private function decideAffirmative(TokenInterface $token, array $attributes, $ob
7575
$deny = 0;
7676
foreach ($this->voters as $voter) {
7777
$result = $voter->vote($token, $object, $attributes);
78-
switch ($result) {
79-
case VoterInterface::ACCESS_GRANTED:
80-
return true;
8178

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

87-
default:
88-
break;
83+
if (VoterInterface::ACCESS_DENIED === $result) {
84+
++$deny;
8985
}
9086
}
9187

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

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

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

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

170-
default:
171-
break;
155+
if (VoterInterface::ACCESS_GRANTED === $result) {
156+
++$grant;
172157
}
173158
}
174159
}

0 commit comments

Comments
 (0)