Skip to content

Commit 653f041

Browse files
committed
remove deprecated code paths
1 parent eedfa9e commit 653f041

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Authorization/AccessDecisionManager.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
1515
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
16+
use Symfony\Component\Security\Core\Exception\InvalidArgumentException;
1617

1718
/**
1819
* AccessDecisionManager is the base class for all access decision managers
@@ -58,7 +59,7 @@ public function __construct(iterable $voters = [], string $strategy = self::STRA
5859
public function decide(TokenInterface $token, array $attributes, $object = null)
5960
{
6061
if (\count($attributes) > 1) {
61-
@trigger_error('Passing more than one Security attribute to '.__METHOD__.' is deprecated since Symfony 4.4. Use multiple decide() calls or the expression language (e.g. "has_role(...) or has_role(...)") instead.', \E_USER_DEPRECATED);
62+
throw new InvalidArgumentException(sprintf('Passing more than one Security attribute to %s() is not supported.', __METHOD__));
6263
}
6364

6465
return $this->{$this->strategy}($token, $attributes, $object);

Authorization/AuthorizationChecker.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface;
1515
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
1616
use Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException;
17+
use Symfony\Component\Security\Core\Exception\InvalidArgumentException;
1718

1819
/**
1920
* AuthorizationChecker is the main authorization point of the Security component.
@@ -53,12 +54,10 @@ final public function isGranted($attributes, $subject = null): bool
5354
$this->tokenStorage->setToken($token = $this->authenticationManager->authenticate($token));
5455
}
5556

56-
if (!\is_array($attributes)) {
57-
$attributes = [$attributes];
58-
} else {
59-
@trigger_error('Passing an array of Security attributes to '.__METHOD__.' is deprecated since Symfony 4.4. Use multiple isGranted() calls or the expression language (e.g. "has_role(...) or has_role(...)") instead.', \E_USER_DEPRECATED);
57+
if (\is_array($attributes)) {
58+
throw new InvalidArgumentException(sprintf('Passing an array of Security attributes to %s() is not supported.', __METHOD__));
6059
}
6160

62-
return $this->accessDecisionManager->decide($token, $attributes, $subject);
61+
return $this->accessDecisionManager->decide($token, (array) $attributes, $subject);
6362
}
6463
}

0 commit comments

Comments
 (0)