diff --git a/security/voters.rst b/security/voters.rst index e7452fadf99..1198f83e7ad 100644 --- a/security/voters.rst +++ b/security/voters.rst @@ -172,9 +172,9 @@ would look like this:: return false; } - // you know $subject is a Post object, thanks to `supports()` - /** @var Post $post */ + // $subject is a Post object, thanks to `supports()` above $post = $subject; + assert($post instanceof Post); return match($attribute) { self::VIEW => $this->canView($post, $user),