Skip to content

Commit 5b62cf7

Browse files
author
nediam
committed
wrong "if" order
1 parent 2069794 commit 5b62cf7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Voter/GateKeeper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ public function supportsClass($class)
7676
*/
7777
public function vote(TokenInterface $token, $object, array $attributes)
7878
{
79-
if (1 !== count($attributes))
79+
if (false === $this->supportsAttribute($attributes[0]))
8080
{
81-
throw new \InvalidArgumentException('Only one attribute is allowed');
81+
return self::ACCESS_ABSTAIN;
8282
}
8383

84-
if (false === $this->supportsAttribute($attributes[0]))
84+
if (1 !== count($attributes))
8585
{
86-
return self::ACCESS_ABSTAIN;
86+
throw new \InvalidArgumentException('Only one attribute is allowed');
8787
}
8888

8989
$user = $token->getUser() instanceof ObjectInterface ? $token->getUser() : null;

0 commit comments

Comments
 (0)