Skip to content

Commit cfa3fb0

Browse files
Introduce stub for Voter
1 parent 2f82309 commit cfa3fb0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Authorization/Voter/Voter.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
*
1919
* @author Roman Marintšenko <[email protected]>
2020
* @author Grégoire Pineau <[email protected]>
21+
*
22+
* @template TAttribute of string
23+
* @template TSubject of mixed
2124
*/
2225
abstract class Voter implements VoterInterface, CacheableVoterInterface
2326
{
@@ -74,13 +77,19 @@ public function supportsType(string $subjectType): bool
7477
/**
7578
* Determines if the attribute and subject are supported by this voter.
7679
*
77-
* @param $subject The subject to secure, e.g. an object the user wants to access or any other PHP type
80+
* @param mixed $subject The subject to secure, e.g. an object the user wants to access or any other PHP type
81+
*
82+
* @psalm-assert-if-true TSubject $subject
83+
* @psalm-assert-if-true TAttribute $attribute
7884
*/
7985
abstract protected function supports(string $attribute, mixed $subject): bool;
8086

8187
/**
8288
* Perform a single access check operation on a given attribute, subject and token.
8389
* It is safe to assume that $attribute and $subject already passed the "supports()" method check.
90+
*
91+
* @param TAttribute $attribute
92+
* @param TSubject $subject
8493
*/
8594
abstract protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool;
8695
}

0 commit comments

Comments
 (0)