-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
Consider this code (I didn't write it):
$var = array(
'tab_template' => '
<li>%s</li>',
'panel_template' => '
<div id="%s">
%s
</div>',
);
You will get two Squiz.Arrays.ArrayDeclaration.NoComma
errors, even though both array values are followed by commas.
This change fixes it for me, but I don't know if it breaks anything else:
Index: CodeSniffer/Standards/Squiz/Sniffs/Arrays/ArrayDeclarationSniff.php
<+>UTF-8
===================================================================
--- CodeSniffer/Standards/Squiz/Sniffs/Arrays/ArrayDeclarationSniff.php (revision 8b75b9c1d842642ecf8997bc3691f0077a5f2546)
+++ CodeSniffer/Standards/Squiz/Sniffs/Arrays/ArrayDeclarationSniff.php (revision )
@@ -837,7 +837,7 @@
}
}//end for
- if ($nextComma === false || ($tokens[$nextComma]['line'] !== $valueLine)) {
+ if ($nextComma === false) {
$error = 'Each line in an array declaration must end in a comma';
$fix = $phpcsFile->addFixableError($error, $index['value'], 'NoComma');
Related: #582.