@@ -71,17 +71,13 @@ private function decideAffirmative(TokenInterface $token, array $attributes, $ob
71
71
$ deny = 0 ;
72
72
foreach ($ this ->voters as $ voter ) {
73
73
$ result = $ voter ->vote ($ token , $ object , $ attributes );
74
- switch ($ result ) {
75
- case VoterInterface::ACCESS_GRANTED :
76
- return true ;
77
74
78
- case VoterInterface::ACCESS_DENIED :
79
- ++$ deny ;
80
-
81
- break ;
75
+ if (VoterInterface::ACCESS_GRANTED === $ result ) {
76
+ return true ;
77
+ }
82
78
83
- default :
84
- break ;
79
+ if (VoterInterface:: ACCESS_DENIED === $ result ) {
80
+ ++ $ deny ;
85
81
}
86
82
}
87
83
@@ -113,16 +109,10 @@ private function decideConsensus(TokenInterface $token, array $attributes, $obje
113
109
foreach ($ this ->voters as $ voter ) {
114
110
$ result = $ voter ->vote ($ token , $ object , $ attributes );
115
111
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 ;
126
116
}
127
117
}
128
118
@@ -154,17 +144,12 @@ private function decideUnanimous(TokenInterface $token, array $attributes, $obje
154
144
foreach ($ attributes as $ attribute ) {
155
145
$ result = $ voter ->vote ($ token , $ object , [$ attribute ]);
156
146
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
+ }
165
150
166
- default :
167
- break ;
151
+ if (VoterInterface:: ACCESS_GRANTED === $ result ) {
152
+ ++ $ grant ;
168
153
}
169
154
}
170
155
}
0 commit comments