Skip to content

Commit

Permalink
wrong "if" order
Browse files Browse the repository at this point in the history
  • Loading branch information
nediam committed May 8, 2014
1 parent 2069794 commit 5b62cf7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Voter/GateKeeper.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ public function supportsClass($class)
*/
public function vote(TokenInterface $token, $object, array $attributes)
{
if (1 !== count($attributes))
if (false === $this->supportsAttribute($attributes[0]))
{
throw new \InvalidArgumentException('Only one attribute is allowed');
return self::ACCESS_ABSTAIN;
}

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

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

0 comments on commit 5b62cf7

Please sign in to comment.