[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
Wed Feb 8 15:57:28 UTC 2023


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

 * status:  closed => reopened
 * severity:  major => normal
 * type:  enhancement => defect (bug)
 * component:  General => Comments
 * milestone:   => 6.2
 * keywords:  needs-patch => has-patch
 * resolution:  duplicate =>


Comment:

 Hi there, thanks for the ticket!

 Yeah, I've started looking into this as well after [55284] / #52322.

 Reopening, as this can be done separately from #56261. That ticket is
 mostly focused on the `comment_ID` value of the comment data array in
 functions like `wp_new_comment()`, `wp_update_comment()`, or
 `wp_filter_comment()`, where plugins may expect both `comment_id` and
 `comment_ID` values to exist in the array.

 This ticket can be focused strictly on renaming the `$comment_ID` variable
 to match core coding standards. This will affect function parameters,
 internal variables, and hook DocBlocks and encourage better practices.

 Aside from using PHP 8.0+ named parameters, which WordPress does not
 explicitly support at this time, backward compatibility should not be
 affected, so I think this can be done in 6.2 as part of other coding
 standards fixes.

 [attachment:57671.diff] resolves all of these 83 WPCS warnings in core:
 {{{
 Variable "$comment_ID" is not in valid snake_case format, try
 "$comment_i_d"
 }}}

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


More information about the wp-trac mailing list