Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions security/voters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ would look like this::

return match($attribute) {
self::VIEW => $this->canView($post, $user),
self::EDIT => $this->canEdit($post, $user),
self::EDIT => $this->canEdit($post, $user, $vote),
default => throw new \LogicException('This code should not be reached!')
};
}
Expand All @@ -202,7 +202,7 @@ would look like this::
return !$post->isPrivate();
}

private function canEdit(Post $post, User $user): bool
private function canEdit(Post $post, User $user, ?Vote $vote): bool
{
// this assumes that the Post object has a `getAuthor()` method
if ($user === $post->getAuthor()) {
Expand Down