File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
stubs/Symfony/Component/Security/Core/Authorization/Voter Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ parameters:
1414 featureToggles :
1515 skipCheckGenericClasses :
1616 - Symfony\Component\OptionsResolver\Options
17+ - Symfony\Component\Security\Core\Authorization\Voter\Voter
1718 - Symfony\Component\Security\Core\User\PasswordUpgraderInterface
1819 stubFiles :
1920 - stubs/Psr/Cache/CacheItemInterface.stub
@@ -50,6 +51,7 @@ parameters:
5051 - stubs/Symfony/Component/Security/Acl/Model/AclInterface.stub
5152 - stubs/Symfony/Component/Security/Acl/Model/EntryInterface.stub
5253 - stubs/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.stub
54+ - stubs/Symfony/Component/Security/Core/Authorization/Voter/Voter.stub
5355 - stubs/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.stub
5456 - stubs/Symfony/Component/Security/Core/User/PasswordAuthenticatedUserInterface.stub
5557 - stubs/Symfony/Component/Security/Core/User/PasswordUpgraderInterface.stub
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Symfony\Component\Security\Core\Authorization\Voter;
4+
5+ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
6+
7+ /**
8+ * @template TAttribute of string
9+ * @template TSubject of mixed
10+ */
11+ abstract class Voter implements VoterInterface
12+ {
13+ /**
14+ * Determines if the attribute and subject are supported by this voter.
15+ *
16+ * @param mixed $subject
17+ *
18+ * @phpstan-assert-if-true TSubject $subject
19+ * @phpstan-assert-if-true TAttribute $attribute
20+ *
21+ * @return bool
22+ */
23+ abstract protected function supports(string $attribute, $subject);
24+
25+ /**
26+ * Perform a single access check operation on a given attribute, subject and token.
27+ * It is safe to assume that $attribute and $subject already passed the "supports()" method check.
28+ *
29+ * @phpstan-param TAttribute $attribute
30+ * @phpstan-param TSubject $subject
31+ *
32+ * @return bool
33+ */
34+ abstract protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token);
35+ }
You can’t perform that action at this time.
0 commit comments