Skip to content

Commit

Permalink
Ignore open paranthesis from ending comma rule.
Browse files Browse the repository at this point in the history
  • Loading branch information
c10b10 committed Oct 4, 2012
1 parent 95a40fb commit 1c5e90c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
*.sw*
tags
2 changes: 1 addition & 1 deletion Sniffs/Arrays/ArrayDeclarationSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
*/
// Check each line ends in a comma.
if ($tokens[$index['value']]['code'] !== T_ARRAY) {
$nextComma = $phpcsFile->findNext(array(T_COMMA), ($index['value'] + 1));
$nextComma = $phpcsFile->findNext(array(T_COMMA, T_OPEN_PARENTHESIS), ($index['value'] + 1));
if (($nextComma === false) || ($tokens[$nextComma]['line'] !== $tokens[$index['value']]['line'])) {
$error = 'Each line in an array declaration must end in a comma';
$phpcsFile->addError($error, $index['value']);
Expand Down

1 comment on commit 1c5e90c

@westonruter
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@c10b10 merged in WordPress#59

Please sign in to comment.