/** * @param $token * @param $i * @param array $tokens * @param array $originalTokens * * @return array */ protected function formatOpeningParenthesis($token, $i, array &$tokens, array &$originalTokens) { $length = 0; for ($j = 1; $j <= 250; $j++) { if (isset($tokens[$i + $j])) { $next = $tokens[$i + $j]; if ($this->parentheses->stringIsClosingParentheses($next)) { $this->parentheses->writeNewInlineParentheses(); break; } if ($this->parentheses->invalidParenthesesTokenValue($next) || $this->parentheses->invalidParenthesesTokenType($next)) { break; } $length += strlen($next[Tokenizer::TOKEN_VALUE]); } } $this->newLine->writeNewLineForLongInlineValues($length); if (WhiteSpace::isPrecedingCurrentTokenOfTokenTypeWhiteSpace($originalTokens, $token)) { $this->formattedSql = rtrim($this->formattedSql, ' '); } $this->newLine->addNewLineAfterOpeningParentheses(); return $tokens; }