Skip to content

Commit 7c53824

Browse files
Coding Standards: Fix alignment and PHPCS ignores in reaction support.
- Fix double-space alignment warning in test file (line 4702). - Extend phpcs:ignore directives in prefetch_reaction_summaries() to cover WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber, acknowledging PHPCS cannot count placeholders through the spread operator. See #63191.
1 parent b6923e7 commit 7c53824

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2111,7 +2111,7 @@ protected function prefetch_reaction_summaries( $note_ids ) {
21112111
$id_placeholders = implode( ',', array_fill( 0, count( $note_ids ), '%d' ) );
21122112

21132113
// Query 1: aggregated counts per emoji per note.
2114-
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
2114+
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber
21152115
$counts = $wpdb->get_results(
21162116
$wpdb->prepare(
21172117
"SELECT comment_parent, comment_content, COUNT(*) AS reaction_count
@@ -2127,7 +2127,7 @@ protected function prefetch_reaction_summaries( $note_ids ) {
21272127
// Query 2: the current user's own reaction IDs (only when logged in).
21282128
$my_reactions = array();
21292129
if ( $current_user_id ) {
2130-
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared
2130+
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber
21312131
$user_rows = $wpdb->get_results(
21322132
$wpdb->prepare(
21332133
"SELECT comment_ID, comment_parent, comment_content

tests/phpunit/tests/rest-api/rest-comments-controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4699,7 +4699,7 @@ public function test_note_response_includes_reaction_summary() {
46994699
)
47004700
);
47014701

4702-
$request = new WP_REST_Request( 'GET', '/wp/v2/comments/' . $note_id );
4702+
$request = new WP_REST_Request( 'GET', '/wp/v2/comments/' . $note_id );
47034703
$request->set_param( 'context', 'edit' );
47044704
$response = rest_get_server()->dispatch( $request );
47054705
$data = $response->get_data();

0 commit comments

Comments
 (0)