[wp-trac] [WordPress Trac] #57671: Coding Standards: To maintain a valid snake case format, need to rename $comment_ID variable

WordPress Trac noreply at wordpress.org
Sun Feb 12 18:06:47 UTC 2023


#57671: Coding Standards: To maintain a valid snake case format, need to rename
$comment_ID variable
--------------------------+-------------------------------
 Reporter:  krunal265     |       Owner:  SergeyBiryukov
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  6.2
Component:  Comments      |     Version:  trunk
 Severity:  normal        |  Resolution:  fixed
 Keywords:  has-patch     |     Focuses:  coding-standards
--------------------------+-------------------------------
Changes (by SergeyBiryukov):

 * status:  accepted => closed
 * resolution:   => fixed


Comment:

 In [changeset:"55308" 55308]:
 {{{
 #!CommitTicketReference repository="" revision="55308"
 Coding Standards: Rename `$comment_ID` variable to `$comment_id` in
 various files.

 This resolves 80+ WPCS warnings in core:
 {{{
 Variable "$comment_ID" is not in valid snake_case format
 }}}

 While matching the database field of the same name, the `$comment_ID`
 variable did not follow the WordPress coding standards, and is now renamed
 to address that.

 This affects:
 * Function parameters in:
  * `get_comment_author()`
  * `comment_author()`
  * `get_comment_author_email()`
  * `comment_author_email()`
  * `get_comment_author_link()`
  * `comment_author_link()`
  * `get_comment_author_IP()`
  * `comment_author_IP()`
  * `get_comment_author_rl()`
  * `comment_author_url()`
  * `get_comment_date()`
  * `comment_date()`
  * `get_comment_excerpt()`
  * `comment_excerpt()`
  * `get_comment_text()`
  * `comment_text()`
  * `get_comment_time()`
  * `comment_time()`
  * `get_comment_type()`
  * `get_page_of_comment()`
  * `wp_new_comment_notify_moderator()`
  * `wp_new_comment_notify_postauthor()`
  * `get_commentdata()`

 * Internal variables in:
  * `get_comment_ID()`
  * `wp_new_comment()`
  * `wp_xmlrpc_server::wp_deleteComment()`
  * `wp_xmlrpc_server::wp_editComment()`
  * `wp_xmlrpc_server::wp_newComment()`
  * `wp_xmlrpc_server::pingback_ping()`

 * Hook parameters in:
  * `get_comment_author`
  * `comment_author`
  * `get_comment_author_email`
  * `author_email`
  * `get_comment_author_link`
  * `get_comment_author_IP`
  * `get_comment_author_url`
  * `comment_url`
  * `get_comment_excerpt`
  * `comment_excerpt`
  * `get_comment_ID`
  * `get_comment_type`
  * `get_page_of_comment`
  * `comment_{$new_status}_{$comment->comment_type}`
  * `comment_post`
  * `notify_moderator`
  * `notify_post_author`
  * `commentrss2_item`
  * `xmlrpc_call_success_wp_deleteComment`
  * `xmlrpc_call_success_wp_editComment`
  * `xmlrpc_call_success_wp_newComment`
  * `pingback_post`

 Note: The name change only affects variable names and DocBlocks.

 The change does not affect:

 * `comment_ID` as the `$orderby` value in
 `WP_Comment_Query::__construct()`
 * `comment_ID` as the `$orderby` value in `WP_Comment::get_children()`
 * `comment_ID` as part of `$commentarr` parameter in `wp_update_comment()`

 The associated array keys still match the database field.

 Follow-up to [53723].

 Props krunal265, costdev, SergeyBiryukov.
 Fixes #57671. See #56791.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57671#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list