[wp-trac] [WordPress Trac] #44225: PHPCS: Assignment must be the first block of code on a line

WordPress Trac noreply at wordpress.org
Fri May 25 14:07:18 UTC 2018


#44225: PHPCS: Assignment must be the first block of code on a line
------------------------------+-------------------------------
 Reporter:  subrataemfluence  |       Owner:  (none)
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  General           |     Version:  trunk
 Severity:  normal            |  Resolution:
 Keywords:  has-patch         |     Focuses:  coding-standards
------------------------------+-------------------------------
Changes (by jrf):

 * keywords:  2nd-opinion has-patch => has-patch


Comment:

 > I would like to ask if the following block of code was overlooked and
 kept intentionally.

 @subrataemfluence No, this block wasn't kept intentionally, but these kind
 of errors can not be auto-fixed by the tooling we used to clean up the
 code as they generally need a developer to check what is the best course
 of action.

 So far, mostly the errors and warnings which can be auto-fixed have made
 it into core. Most manual fixes still need to be done.

 > Does this create additional overhead if the declaration and assignment
 are done in two lines?

 It creates additional overhead in the head of developers who can't find
 the assignment ;-)

 For PHP it makes no difference at all. This rule is about code
 readability.

 > I have uploaded a patch to meet WordPress-Core standard

 Thanks for that and I concur with @GaryJ that the patch looks good. I
 unfortunately can't add the `commit` keyword.

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


More information about the wp-trac mailing list