@@ -86,17 +86,13 @@ private function decideAffirmative(TokenInterface $token, array $attributes, $ob
8686 $ deny = 0 ;
8787 foreach ($ this ->voters as $ voter ) {
8888 $ result = $ this ->vote ($ voter , $ token , $ object , $ attributes );
89- switch ($ result ) {
90- case VoterInterface::ACCESS_GRANTED :
91- return true ;
9289
93- case VoterInterface::ACCESS_DENIED :
94- ++$ deny ;
95-
96- break ;
90+ if (VoterInterface::ACCESS_GRANTED === $ result ) {
91+ return true ;
92+ }
9793
98- default :
99- break ;
94+ if (VoterInterface:: ACCESS_DENIED === $ result ) {
95+ ++ $ deny ;
10096 }
10197 }
10298
@@ -128,16 +124,10 @@ private function decideConsensus(TokenInterface $token, array $attributes, $obje
128124 foreach ($ this ->voters as $ voter ) {
129125 $ result = $ this ->vote ($ voter , $ token , $ object , $ attributes );
130126
131- switch ($ result ) {
132- case VoterInterface::ACCESS_GRANTED :
133- ++$ grant ;
134-
135- break ;
136-
137- case VoterInterface::ACCESS_DENIED :
138- ++$ deny ;
139-
140- break ;
127+ if (VoterInterface::ACCESS_GRANTED === $ result ) {
128+ ++$ grant ;
129+ } elseif (VoterInterface::ACCESS_DENIED === $ result ) {
130+ ++$ deny ;
141131 }
142132 }
143133
@@ -169,17 +159,12 @@ private function decideUnanimous(TokenInterface $token, array $attributes, $obje
169159 foreach ($ attributes as $ attribute ) {
170160 $ result = $ this ->vote ($ voter , $ token , $ object , [$ attribute ]);
171161
172- switch ($ result ) {
173- case VoterInterface::ACCESS_GRANTED :
174- ++$ grant ;
175-
176- break ;
177-
178- case VoterInterface::ACCESS_DENIED :
179- return false ;
162+ if (VoterInterface::ACCESS_DENIED === $ result ) {
163+ return false ;
164+ }
180165
181- default :
182- break ;
166+ if (VoterInterface:: ACCESS_GRANTED === $ result ) {
167+ ++ $ grant ;
183168 }
184169 }
185170 }
0 commit comments