// recognize array declaration for nice output
if (previousCompilableToken == TokenNamearray) {
arrayDeclarationCount++;
- arrayDeclarationParenthesis[arrayDeclarationCount] = openParenthesis[openParenthesisCount];
+ arrayDeclarationParenthesis[arrayDeclarationCount] = openParenthesis[openParenthesisCount - 1];
indentationLevel++;
pendingNewLines = 1;
}
case TokenNameRPAREN:
// check for closing array declaration
if (arrayDeclarationCount > 0) {
- if (arrayDeclarationParenthesis[arrayDeclarationCount] == openParenthesis[openParenthesisCount]) {
+ if (arrayDeclarationParenthesis[arrayDeclarationCount] == openParenthesis[openParenthesisCount - 1]) {
if (previousCompilableToken != TokenNameLPAREN) {
newLine(1);
+ } else if (previousToken == TokenNameCOMMENT_LINE
+ || previousToken == TokenNameCOMMENT_BLOCK
+ || previousToken == TokenNameCOMMENT_PHPDOC) {
+ // prevent to combine comment line and statement line (#1475484)
+ newLine(1);
}
indentationLevel--;
currentLineIndentationLevel = indentationLevel;
case TokenNameCOMMA:
pendingSpace = false;
if (arrayDeclarationCount > 0) {
- pendingNewLines = 1;
+ if (arrayDeclarationParenthesis[arrayDeclarationCount] == openParenthesis[openParenthesisCount - 1]) {
+ // there is no left parenthesis to close in current array declaration (#1475484)
+ pendingNewLines = 1;
+ }
}
break;
case TokenNameDOT:
break;
case Scanner.TokenNameCOMMENT_LINE:
pendingNewLines = 1;
- if (inAssignment) {
- currentLineIndentationLevel++;
- }
+ //if (inAssignment) {
+ // currentLineIndentationLevel++;
+ //}
break; // a line is always inserted after a one-line
// comment
case Scanner.TokenNameCOMMENT_PHPDOC: