1 | <?php |
||
14 | class HandleCommandVoter extends Voter |
||
15 | { |
||
16 | /** |
||
17 | * The decision manager. |
||
18 | * |
||
19 | * @var AccessDecisionManagerInterface |
||
20 | */ |
||
21 | private $decisionManager; |
||
22 | |||
23 | /** |
||
24 | * Command - Require role mapping |
||
25 | * |
||
26 | * @var array |
||
27 | */ |
||
28 | private $commandRoleMapping; |
||
29 | |||
30 | /** |
||
31 | * Create a new HandleCommandVoter. |
||
32 | * |
||
33 | * @param AccessDecisionManagerInterface $decisionManager |
||
34 | * @param array $commandRoleMapping |
||
35 | * @param string $defaultRole |
||
|
|||
36 | */ |
||
37 | 24 | public function __construct(AccessDecisionManagerInterface $decisionManager, array $commandRoleMapping = []) |
|
42 | |||
43 | /** |
||
44 | * The voter supports checking handle commands |
||
45 | * |
||
46 | * @param string $attribute |
||
47 | * @param object $subject |
||
48 | * @return bool |
||
49 | */ |
||
50 | 24 | protected function supports($attribute, $subject) |
|
54 | |||
55 | /** |
||
56 | * Checks if the currently logged on user may handle $subject. |
||
57 | * |
||
58 | * @param type $attribute |
||
59 | * @param type $subject |
||
60 | * @param TokenInterface $token |
||
61 | * |
||
62 | * @return bool |
||
63 | */ |
||
64 | 15 | protected function voteOnAttribute($attribute, $subject, TokenInterface $token) |
|
75 | |||
76 | /** |
||
77 | * Gets the roles allowed to handle a command of $type |
||
78 | * |
||
79 | * @param string $type |
||
80 | * @return array |
||
81 | */ |
||
82 | 15 | private function getAllowedRoles($type) |
|
90 | } |
||
91 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.