Skip to content

Commit 5c5f078

Browse files
Merge branch '3.4' into 4.3
* 3.4: CS [Serializer] Skip uninitialized (PHP 7.4) properties in PropertyNormalizer and ObjectNormalizer stop using deprecated Doctrine persistence classes Fix regex lookahead syntax in ApplicationTest [SecurityBundle][FirewallMap] Remove unused property [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 fix comparisons with null values at property paths
2 parents 9dc5743 + 846ff3e commit 5c5f078

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
@@ -71,17 +71,13 @@ private function decideAffirmative(TokenInterface $token, array $attributes, $ob
7171
$deny = 0;
7272
foreach ($this->voters as $voter) {
7373
$result = $voter->vote($token, $object, $attributes);
74-
switch ($result) {
75-
case VoterInterface::ACCESS_GRANTED:
76-
return true;
7774

78-
case VoterInterface::ACCESS_DENIED:
79-
++$deny;
80-
81-
break;
75+
if (VoterInterface::ACCESS_GRANTED === $result) {
76+
return true;
77+
}
8278

83-
default:
84-
break;
79+
if (VoterInterface::ACCESS_DENIED === $result) {
80+
++$deny;
8581
}
8682
}
8783

@@ -113,16 +109,10 @@ private function decideConsensus(TokenInterface $token, array $attributes, $obje
113109
foreach ($this->voters as $voter) {
114110
$result = $voter->vote($token, $object, $attributes);
115111

116-
switch ($result) {
117-
case VoterInterface::ACCESS_GRANTED:
118-
++$grant;
119-
120-
break;
121-
122-
case VoterInterface::ACCESS_DENIED:
123-
++$deny;
124-
125-
break;
112+
if (VoterInterface::ACCESS_GRANTED === $result) {
113+
++$grant;
114+
} elseif (VoterInterface::ACCESS_DENIED === $result) {
115+
++$deny;
126116
}
127117
}
128118

@@ -154,17 +144,12 @@ private function decideUnanimous(TokenInterface $token, array $attributes, $obje
154144
foreach ($attributes as $attribute) {
155145
$result = $voter->vote($token, $object, [$attribute]);
156146

157-
switch ($result) {
158-
case VoterInterface::ACCESS_GRANTED:
159-
++$grant;
160-
161-
break;
162-
163-
case VoterInterface::ACCESS_DENIED:
164-
return false;
147+
if (VoterInterface::ACCESS_DENIED === $result) {
148+
return false;
149+
}
165150

166-
default:
167-
break;
151+
if (VoterInterface::ACCESS_GRANTED === $result) {
152+
++$grant;
168153
}
169154
}
170155
}

0 commit comments

Comments
 (0)