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

WordPress Trac noreply at wordpress.org
Mon Jul 18 18:29:53 UTC 2022


#56243: Use a consistent parameter name for functions accepting a post ID or post
object
-------------------------------+-------------------------------------
 Reporter:  SergeyBiryukov     |       Owner:  SergeyBiryukov
     Type:  enhancement        |      Status:  accepted
 Priority:  normal             |   Milestone:  6.1
Component:  Posts, Post Types  |     Version:
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:  docs, coding-standards
-------------------------------+-------------------------------------

Comment (by pbiron):

 Replying to [comment:4 SergeyBiryukov]:
 > Replying to [comment:3 pbiron]:
 > > I can provide a list of those occurrences if needed...
 >
 > That would be helpful, thanks!

 Will do that in the next few days.

 > Indeed, I've started looking into that too and will open a similar
 ticket for those :)  It's worth noting that `$comment_ID` causes a WPCS
 warning and should be fixed anyway:
 > {{{
 > | WARNING | [ ] Variable "$comment_ID" is not in valid snake_case
 > |         |     format, try "$comment_i_d"
 > |         |
 (WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase)
 > }}}

 The WPCS errors are what brought those to my attention.  In plugins I
 write, when I hook into actions/filters, I try to name the parameters to
 my callbacks **exactly** the same as in the core hook DocBlock...and I
 often have to add `// phpcs:ignore
 WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase` to
 silences those warnings (and I've been working on one such plugin that
 deals with comments lately :-).

 I'll keep an eye out for that other ticket being opened.  thanx!

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


More information about the wp-trac mailing list