@@ -118,7 +118,7 @@ would look like this::
118
118
const VIEW = 'view';
119
119
const EDIT = 'edit';
120
120
121
- protected function supports($attribute, $subject)
121
+ protected function supports(string $attribute, $subject)
122
122
{
123
123
// if the attribute isn't one we support, return false
124
124
if (!in_array($attribute, [self::VIEW, self::EDIT])) {
@@ -133,7 +133,7 @@ would look like this::
133
133
return true;
134
134
}
135
135
136
- protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
136
+ protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token)
137
137
{
138
138
$user = $token->getUser();
139
139
@@ -178,7 +178,7 @@ That's it! The voter is done! Next, :ref:`configure it <declaring-the-voter-as-a
178
178
179
179
To recap, here's what's expected from the two abstract methods:
180
180
181
- ``Voter::supports($attribute, $subject) ``
181
+ ``Voter::supports(string $attribute, $subject) ``
182
182
When ``isGranted() `` (or ``denyAccessUnlessGranted() ``) is called, the first
183
183
argument is passed here as ``$attribute `` (e.g. ``ROLE_USER ``, ``edit ``) and
184
184
the second argument (if any) is passed as ``$subject `` (e.g. ``null ``, a ``Post ``
@@ -188,7 +188,7 @@ To recap, here's what's expected from the two abstract methods:
188
188
return ``true `` if the attribute is ``view `` or ``edit `` and if the object is
189
189
a ``Post `` instance.
190
190
191
- ``voteOnAttribute($attribute, $subject, TokenInterface $token) ``
191
+ ``voteOnAttribute(string $attribute, $subject, TokenInterface $token) ``
192
192
If you return ``true `` from ``supports() ``, then this method is called. Your
193
193
job is simple: return ``true `` to allow access and ``false `` to deny access.
194
194
The ``$token `` can be used to find the current user object (if any). In this
@@ -231,7 +231,7 @@ with ``ROLE_SUPER_ADMIN``::
231
231
$this->security = $security;
232
232
}
233
233
234
- protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
234
+ protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token)
235
235
{
236
236
// ...
237
237
0 commit comments