Skip to content

Commit e9ad359

Browse files
authored
[make:voter] Set subject for subject in Voter template (#1221)
1 parent a814746 commit e9ad359

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Resources/skeleton/security/Voter.tpl.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ class <?= $class_name ?> extends Voter
1111
public const EDIT = 'POST_EDIT';
1212
public const VIEW = 'POST_VIEW';
1313

14-
protected function supports(string $attribute, $subject): bool
14+
protected function supports(string $attribute, mixed $subject): bool
1515
{
1616
// replace with your own logic
1717
// https://symfony.com/doc/current/security/voters.html
1818
return in_array($attribute, [self::EDIT, self::VIEW])
1919
&& $subject instanceof \App\Entity\<?= str_replace('Voter', null, $class_name) ?>;
2020
}
2121

22-
protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token): bool
22+
protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool
2323
{
2424
$user = $token->getUser();
2525
// if the user is anonymous, do not grant access

0 commit comments

Comments
 (0)