| @@ 670-681 (lines=12) @@ | ||
| 667 | $indexLine = $tokens[$stackPtr]['line']; |
|
| 668 | $lastIndexLine = null; |
|
| 669 | foreach ($indices as $index) { |
|
| 670 | if (isset($index['index']) === false) { |
|
| 671 | // Array value only. |
|
| 672 | if ($tokens[$index['value']]['line'] === $tokens[$stackPtr]['line'] && $numValues > 1) { |
|
| 673 | $error = 'The first value in a multi-value array must be on a new line'; |
|
| 674 | $fix = $phpcsFile->addFixableError($error, $stackPtr, 'FirstValueNoNewline'); |
|
| 675 | if ($fix === true) { |
|
| 676 | $phpcsFile->fixer->addNewlineBefore($index['value']); |
|
| 677 | } |
|
| 678 | } |
|
| 679 | ||
| 680 | continue; |
|
| 681 | } |
|
| 682 | ||
| 683 | $lastIndexLine = $indexLine; |
|
| 684 | $indexLine = $tokens[$index['index']]['line']; |
|
| @@ 416-427 (lines=12) @@ | ||
| 413 | $indexLine = $tokens[ $stackPtr ]['line']; |
|
| 414 | $lastIndexLine = null; |
|
| 415 | foreach ( $indices as $index ) { |
|
| 416 | if ( ! isset( $index['index'] ) ) { |
|
| 417 | // Array value only. |
|
| 418 | if ( $tokens[ $index['value'] ]['line'] === $tokens[ $stackPtr ]['line'] && $numValues > 1 ) { |
|
| 419 | $error = 'The first value in a multi-value array must be on a new line'; |
|
| 420 | $fix = $phpcsFile->addFixableError( $error, $stackPtr, 'FirstValueNoNewline' ); |
|
| 421 | if ( true === $fix ) { |
|
| 422 | $phpcsFile->fixer->addNewlineBefore( $index['value'] ); |
|
| 423 | } |
|
| 424 | } |
|
| 425 | ||
| 426 | continue; |
|
| 427 | } |
|
| 428 | ||
| 429 | $lastIndexLine = $indexLine; |
|
| 430 | $indexLine = $tokens[ $index['index'] ]['line']; |
|