From 01f381305940492ddbbfc0ab54a30db383971ac4 Mon Sep 17 00:00:00 2001 From: ifiroth <97906657+ifiroth@users.noreply.github.com> Date: Tue, 27 May 2025 11:11:06 +0200 Subject: [PATCH] Update voters.rst I think you're missing an argument here --- security/voters.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/voters.rst b/security/voters.rst index 2b4a5af54e2..f20e1de62af 100644 --- a/security/voters.rst +++ b/security/voters.rst @@ -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!') }; } @@ -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()) {