[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 13:10:35 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            |   Keywords:  2nd-opinion has-patch
  Focuses:  coding-standards  |
------------------------------+-----------------------------------
 Although WordPress-Core standard is reporting this as an error, I would
 like to ask if the following block of code was overlooked and kept
 intentionally.

 File: wp-admin/includes/plugin.php
 Line number: 146

 The code block being reported is:

 {{{#!php
 <?php
 $allowed_tags = $allowed_tags_in_links = array(
     'abbr'    => array( 'title' => true ),
     'acronym' => array( 'title' => true ),
     'code'    => true,
     'em'      => true,
     'strong'  => true,
 );
 }}}


 While according to the standards it should be:

 {{{#!php
 <?php
 $allowed_tags_in_links = array(
     'abbr'    => array( 'title' => true ),
     'acronym' => array( 'title' => true ),
     'code'    => true,
     'em'      => true,
     'strong'  => true,
 );

 $allowed_tags      = $allowed_tags_in_links;
 }}}

 Does this create additional overhead if the declaration and assignment are
 done in two lines? I have uploaded a patch to meet WordPress-Core standard
 but will love to know if this is really a necessity! And if not, why.

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


More information about the wp-trac mailing list