[wp-trac] [WordPress Trac] #56244: Use a consistent parameter name for functions accepting a comment ID or object

WordPress Trac noreply at wordpress.org
Mon Jul 18 20:49:35 UTC 2022


#56244: Use a consistent parameter name for functions accepting a comment ID or
object
----------------------------+-------------------------------------
 Reporter:  SergeyBiryukov  |       Owner:  SergeyBiryukov
     Type:  enhancement     |      Status:  accepted
 Priority:  normal          |   Milestone:  6.1
Component:  Comments        |     Version:
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:  docs, coding-standards
----------------------------+-------------------------------------
Changes (by audrasjb):

 * keywords:  2nd-opinion =>


Comment:

 Replying to [comment:3 SergeyBiryukov]:
 > Thanks for the comment! To me, it's confusing when `$comment_id` can
 mean two different things:
 > * A comment ID.
 > * A comment object.
 >
 > I would like to separate these, so that:
 >  * `$comment_id` always means a (numeric) comment ID.
 >  * `$comment` as a function parameter means either a comment ID or
 comment object, but is typically converted to an object within the first
 lines of the function.

 It totally makes sense to me now! thanks for the clarification 🙏

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


More information about the wp-trac mailing list