From 89e67bb94f14f062bf2b9cf89080e155bd61d503 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Thu, 5 Feb 2026 12:25:16 +0100 Subject: [PATCH] fix: remove redundant comment_id property from Clean_Emails The comment_id was stored separately but duplicated the value available via $this->comment->comment_ID. Removed the property and updated the single usage in comment_action_link(). Co-Authored-By: Claude Opus 4.5 --- inc/clean-emails.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/inc/clean-emails.php b/inc/clean-emails.php index ae6b996..e7b3c86 100644 --- a/inc/clean-emails.php +++ b/inc/clean-emails.php @@ -10,11 +10,6 @@ */ class Clean_Emails { - /** - * Holds the current comment's ID. - */ - private int $comment_id = 0; - /** * Holds the current comment. */ @@ -231,9 +226,8 @@ private function wrap_message(): string { * @return void */ private function setup_data( int $comment_id ): void { - $this->comment_id = $comment_id; - $this->comment = \get_comment( $this->comment_id ); - $this->post = \get_post( (int) $this->comment->comment_post_ID ); + $this->comment = \get_comment( $comment_id ); + $this->post = \get_post( (int) $this->comment->comment_post_ID ); } /** @@ -318,7 +312,7 @@ private function comment_action_links( array $actions ): void { * @return string */ private function comment_action_link( string $label, string $action ): string { - $url = \admin_url( \sprintf( 'comment.php?action=%s&c=%d', $action, $this->comment_id ) ); + $url = \admin_url( \sprintf( 'comment.php?action=%s&c=%d', $action, $this->comment->comment_ID ) ); return '' . \esc_html( $label ) . ''; }