| @@ 696-708 (lines=13) @@ | ||
| 693 | continue; |
|
| 694 | } |
|
| 695 | ||
| 696 | if ($indexLine === $lastIndexLine) { |
|
| 697 | $error = 'Each index in a multi-line array must be on a new line'; |
|
| 698 | $fix = $phpcsFile->addFixableError($error, $index['index'], 'IndexNoNewline'); |
|
| 699 | if ($fix === true) { |
|
| 700 | if ($tokens[($index['index'] - 1)]['code'] === T_WHITESPACE) { |
|
| 701 | $phpcsFile->fixer->replaceToken(($index['index'] - 1), ''); |
|
| 702 | } |
|
| 703 | ||
| 704 | $phpcsFile->fixer->addNewlineBefore($index['index']); |
|
| 705 | } |
|
| 706 | ||
| 707 | continue; |
|
| 708 | } |
|
| 709 | ||
| 710 | if ($tokens[$index['index']]['column'] !== $indicesStart) { |
|
| 711 | $expected = ($indicesStart - 1); |
|
| @@ 442-454 (lines=13) @@ | ||
| 439 | continue; |
|
| 440 | } |
|
| 441 | ||
| 442 | if ( $indexLine === $lastIndexLine ) { |
|
| 443 | $error = 'Each index in a multi-line array must be on a new line'; |
|
| 444 | $fix = $phpcsFile->addFixableError( $error, $index['index'], 'IndexNoNewline' ); |
|
| 445 | if ( true === $fix ) { |
|
| 446 | if ( T_WHITESPACE === $tokens[ ( $index['index'] - 1 ) ]['code'] ) { |
|
| 447 | $phpcsFile->fixer->replaceToken( ( $index['index'] - 1 ), '' ); |
|
| 448 | } |
|
| 449 | ||
| 450 | $phpcsFile->fixer->addNewlineBefore( $index['index'] ); |
|
| 451 | } |
|
| 452 | ||
| 453 | continue; |
|
| 454 | } |
|
| 455 | ||
| 456 | // Check each line ends in a comma. |
|
| 457 | $valueLine = $tokens[ $index['value'] ]['line']; |
|