Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.7.2

Bug #19162 Trailing comma on array declaration
Submitted: 2011-12-29 15:37 UTC
From: garyj Assigned:
Status: Bogus Package: PHP_CodeSniffer (version 1.3.2)
PHP Version: 5.3.8 OS: Windows 7
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 16 + 30 = ?

 
 [2011-12-29 15:37 UTC] garyj (Gary Jones)
Description: ------------ Running PHP_CodeSniffer via a phing build on Jenkins, I get that one of the arrays has no trailing comma, yet I believe it has. It's only a single item in the array, and the value of it is multiple nested function calls which itself includes an array. I've got a similar bit of code lower down in my file which also produces the same error. Test script: --------------- $actions = array( 'install' => sprintf( // Line 1179 '<a href="%1$s" title="Install %2$s">Install</a>', wp_nonce_url( add_query_arg( array( 'page' => TGM_Plugin_Activation::$instance->menu, 'plugin' => $item['slug'], 'plugin_name' => $item['sanitized_plugin'], 'plugin_source' => $item['url'], 'tgmpa-install' => 'install-plugin', ), admin_url( TGM_Plugin_Activation::$instance->parent_url_slug ) ), 'tgmpa-install' ), $item['sanitized_plugin'] ), // <-- This comma not seen by PHP_CodeSniffer? ); Expected result: ---------------- I'd expect no array trailing comma warning to appear. Actual result: -------------- class-tgm-plugin-activation.php:1179, ArrayDeclaration, Priority: High Each line in an array declaration must end in a comma

Comments

 [2011-12-29 16:19 UTC] cweiske (Christian Weiske)