Adds a new $voter
argument in protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token, ?Vote $vote = null): bool
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
final class MyVoter extends Voter
{
protected function supports(string $attribute, mixed $subject): bool
{
return true;
}
- protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token): bool
+ protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token, ?\Symfony\Component\Security\Core\Authorization\Voter\Vote $vote = null): bool
{
return true;
}
}
Configure your rector.php
:
<?php
use Rector\Config\RectorConfig;
use Rector\Symfony\Symfony73\Rector\Class_\AddVoteArgumentToVoteOnAttributeRector;
return RectorConfig::configure()
->withRules([
AddVoteArgumentToVoteOnAttributeRector::class,
]);