File tree 2 files changed +37
-0
lines changed
stubs/Symfony/Component/Security/Core/Authorization/Voter
2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ parameters:
14
14
featureToggles :
15
15
skipCheckGenericClasses :
16
16
- Symfony\Component\OptionsResolver\Options
17
+ - Symfony\Component\Security\Core\Authorization\Voter\Voter
17
18
- Symfony\Component\Security\Core\User\PasswordUpgraderInterface
18
19
stubFiles :
19
20
- stubs/Psr/Cache/CacheItemInterface.stub
@@ -50,6 +51,7 @@ parameters:
50
51
- stubs/Symfony/Component/Security/Acl/Model/AclInterface.stub
51
52
- stubs/Symfony/Component/Security/Acl/Model/EntryInterface.stub
52
53
- stubs/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.stub
54
+ - stubs/Symfony/Component/Security/Core/Authorization/Voter/Voter.stub
53
55
- stubs/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.stub
54
56
- stubs/Symfony/Component/Security/Core/User/PasswordAuthenticatedUserInterface.stub
55
57
- 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