| @@ 283-296 (lines=14) @@ | ||
| 280 | } |
|
| 281 | }//end if |
|
| 282 | ||
| 283 | if ($tokens[($comma - 1)]['code'] === T_WHITESPACE) { |
|
| 284 | $content = $tokens[($comma - 2)]['content']; |
|
| 285 | $spaceLength = $tokens[($comma - 1)]['length']; |
|
| 286 | $error = 'Expected 0 spaces between "%s" and comma; %s found'; |
|
| 287 | $data = array( |
|
| 288 | $content, |
|
| 289 | $spaceLength, |
|
| 290 | ); |
|
| 291 | ||
| 292 | $fix = $phpcsFile->addFixableError($error, $comma, 'SpaceBeforeComma', $data); |
|
| 293 | if ($fix === true) { |
|
| 294 | $phpcsFile->fixer->replaceToken(($comma - 1), ''); |
|
| 295 | } |
|
| 296 | } |
|
| 297 | }//end foreach |
|
| 298 | }//end if |
|
| 299 | ||
| @@ 844-857 (lines=14) @@ | ||
| 841 | } |
|
| 842 | ||
| 843 | // Check that there is no space before the comma. |
|
| 844 | if ($nextComma !== false && $tokens[($nextComma - 1)]['code'] === T_WHITESPACE) { |
|
| 845 | $content = $tokens[($nextComma - 2)]['content']; |
|
| 846 | $spaceLength = $tokens[($nextComma - 1)]['length']; |
|
| 847 | $error = 'Expected 0 spaces between "%s" and comma; %s found'; |
|
| 848 | $data = array( |
|
| 849 | $content, |
|
| 850 | $spaceLength, |
|
| 851 | ); |
|
| 852 | ||
| 853 | $fix = $phpcsFile->addFixableError($error, $nextComma, 'SpaceBeforeComma', $data); |
|
| 854 | if ($fix === true) { |
|
| 855 | $phpcsFile->fixer->replaceToken(($nextComma - 1), ''); |
|
| 856 | } |
|
| 857 | } |
|
| 858 | }//end foreach |
|
| 859 | ||
| 860 | }//end processMultiLineArray() |
|
| @@ 508-521 (lines=14) @@ | ||
| 505 | } |
|
| 506 | ||
| 507 | // Check that there is no space before the comma. |
|
| 508 | if ( false !== $nextComma && T_WHITESPACE === $tokens[ ( $nextComma - 1 ) ]['code'] ) { |
|
| 509 | $content = $tokens[ ( $nextComma - 2 ) ]['content']; |
|
| 510 | $spaceLength = $tokens[ ( $nextComma - 1 ) ]['length']; |
|
| 511 | $error = 'Expected 0 spaces between "%s" and comma; %s found'; |
|
| 512 | $data = array( |
|
| 513 | $content, |
|
| 514 | $spaceLength, |
|
| 515 | ); |
|
| 516 | ||
| 517 | $fix = $phpcsFile->addFixableError( $error, $nextComma, 'SpaceBeforeComma', $data ); |
|
| 518 | if ( true === $fix ) { |
|
| 519 | $phpcsFile->fixer->replaceToken( ( $nextComma - 1 ), '' ); |
|
| 520 | } |
|
| 521 | } |
|
| 522 | } // end foreach |
|
| 523 | ||
| 524 | } // end processMultiLineArray() |
|