private function fixArray(Tokens $tokens, $index)
{
if (!$tokens->isArrayMultiLine($index)) {
return;
}

$startIndex = $index;

if ($tokens[$startIndex]->isGivenKind(T_ARRAY)) {
$startIndex = $tokens->getNextTokenOfKind($startIndex, array('('));
$endIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $startIndex);
} else {
$endIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_SQUARE_BRACE, $startIndex);
}

$beforeEndIndex = $tokens->getPrevMeaningfulToken($endIndex);
$beforeEndToken = $tokens[$beforeEndIndex];


 if ($startIndex !== $beforeEndIndex && !$beforeEndToken->equalsAny(array(',', array(T_END_HEREDOC)))) {
$tokens->insertAt($beforeEndIndex + 1, new Token(','));

$endToken = $tokens[$endIndex];

if (!$endToken->isComment() && !$endToken->isWhitespace()) {
$tokens->ensureWhitespaceAtIndex($endIndex, 1, ' ');
}
}
}
 private function fixArray(Tokens $tokens, $index)
 {
     if ($tokens->isArrayMultiLine($index)) {
         return;
     }
     $startIndex = $index;
     if ($tokens[$startIndex]->isGivenKind(T_ARRAY)) {
         $startIndex = $tokens->getNextTokenOfKind($startIndex, array('('));
         $endIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $startIndex);
     } else {
         $endIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_SQUARE_BRACE, $startIndex);
     }
     $beforeEndIndex = $tokens->getPrevMeaningfulToken($endIndex);
     $beforeEndToken = $tokens[$beforeEndIndex];
     if ($beforeEndToken->equals(',')) {
         $tokens->removeTrailingWhitespace($beforeEndIndex);
         $beforeEndToken->clear();
     }
 }
 private function fixArray(Tokens $tokens, $index)
 {
     if (!$tokens->isArrayMultiLine($index)) {
         return;
     }
     $startIndex = $index;
     if ($tokens[$startIndex]->isGivenKind(T_ARRAY)) {
         $startIndex = $tokens->getNextTokenOfKind($startIndex, array('('));
         $endIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $startIndex);
     } else {
         $endIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_SQUARE_BRACE, $startIndex);
     }
     $beforeEndIndex = $tokens->getTokenNotOfKindSibling($endIndex, -1, array(array(T_WHITESPACE), array(T_COMMENT), array(T_DOC_COMMENT)));
     $beforeEndToken = $tokens[$beforeEndIndex];
     // if there is some item between braces then add `,` after it
     if ($startIndex !== $beforeEndIndex && !$beforeEndToken->equalsAny(array(',', array(T_END_HEREDOC)))) {
         $tokens->insertAt($beforeEndIndex + 1, new Token(','));
     }
 }