| @@ 831-840 (lines=10) @@ | ||
| 828 | $error = 'Each line in an array declaration must end in a comma'; |
|
| 829 | $fix = $phpcsFile->addFixableError($error, $index['value'], 'NoComma'); |
|
| 830 | ||
| 831 | if ($fix === true) { |
|
| 832 | // Find the end of the line and put a comma there. |
|
| 833 | for ($i = ($index['value'] + 1); $i < $arrayEnd; $i++) { |
|
| 834 | if ($tokens[$i]['line'] > $valueLine) { |
|
| 835 | break; |
|
| 836 | } |
|
| 837 | } |
|
| 838 | ||
| 839 | $phpcsFile->fixer->addContentBefore(($i - 1), ','); |
|
| 840 | } |
|
| 841 | } |
|
| 842 | ||
| 843 | // Check that there is no space before the comma. |
|
| @@ 495-504 (lines=10) @@ | ||
| 492 | $error = 'Each line in an array declaration must end in a comma'; |
|
| 493 | $fix = $phpcsFile->addFixableError( $error, $index['value'], 'NoComma' ); |
|
| 494 | ||
| 495 | if ( true === $fix ) { |
|
| 496 | // Find the end of the line and put a comma there. |
|
| 497 | for ( $i = ( $index['value'] + 1 ); $i < $phpcsFile->numTokens; $i++ ) { |
|
| 498 | if ( $tokens[ $i ]['line'] > $valueLine ) { |
|
| 499 | break; |
|
| 500 | } |
|
| 501 | } |
|
| 502 | ||
| 503 | $phpcsFile->fixer->addContentBefore( ( $i - 1 ), ',' ); |
|
| 504 | } |
|
| 505 | } |
|
| 506 | ||
| 507 | // Check that there is no space before the comma. |
|