Run Rector on your code to see what it can do for you:
final class DemoFile extends Voter { public function __construct( - private readonly AuthorizationCheckerInterface $authorizationChecker, + private readonly \Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface $accessDecisionManager, ) {} protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token, ?Vote $vote = null): bool { - return $this->authorizationChecker->isGranted('ROLE_ADMIN', $subject); + return $this->accessDecisionManager->decide($token, ['ROLE_ADMIN']); } }
Applied Rules:
Not a change you expect?
rector.php