| @@ 514-524 (lines=11) @@ | ||
| 511 | // Check for mutli-line arrays that should be single-line. |
|
| 512 | $singleValue = false; |
|
| 513 | ||
| 514 | if (empty($indices) === true) { |
|
| 515 | $singleValue = true; |
|
| 516 | } else if (count($indices) === 1 && $tokens[$lastToken]['code'] === T_COMMA) { |
|
| 517 | // There may be another array value without a comma. |
|
| 518 | $exclude = PHP_CodeSniffer_Tokens::$emptyTokens; |
|
| 519 | $exclude[] = T_COMMA; |
|
| 520 | $nextContent = $phpcsFile->findNext($exclude, ($indices[0]['value'] + 1), $arrayEnd, true); |
|
| 521 | if ($nextContent === false) { |
|
| 522 | $singleValue = true; |
|
| 523 | } |
|
| 524 | } |
|
| 525 | ||
| 526 | if ($singleValue === true) { |
|
| 527 | // Array cannot be empty, so this is a multi-line array with |
|
| @@ 311-321 (lines=11) @@ | ||
| 308 | // Check for mutli-line arrays that should be single-line. |
|
| 309 | $singleValue = false; |
|
| 310 | ||
| 311 | if ( empty( $indices ) ) { |
|
| 312 | $singleValue = true; |
|
| 313 | } elseif ( 1 === count( $indices ) && T_COMMA === $tokens[ $lastToken ]['code'] ) { |
|
| 314 | // There may be another array value without a comma. |
|
| 315 | $exclude = PHP_CodeSniffer_Tokens::$emptyTokens; |
|
| 316 | $exclude[] = T_COMMA; |
|
| 317 | $nextContent = $phpcsFile->findNext( $exclude, ( $indices[0]['value'] + 1 ), $arrayEnd, true ); |
|
| 318 | if ( false === $nextContent ) { |
|
| 319 | $singleValue = true; |
|
| 320 | } |
|
| 321 | } |
|
| 322 | ||
| 323 | /* |
|
| 324 | This section checks for arrays that don't specify keys. |
|