@@ -190,24 +190,26 @@ public function processMultiLineCall(PHP_CodeSniffer_File $phpcsFile, $stackPtr,
190
190
if ($ tokens [($ openBracket + 1 )]['content ' ] !== $ phpcsFile ->eolChar ) {
191
191
$ error = 'Opening parenthesis of a multi-line function call must be the last content on the line ' ;
192
192
$ phpcsFile ->addError ($ error , $ stackPtr , 'ContentAfterOpenBracket ' );
193
- $ phpcsFile ->fixer ->addNewline ($ openBracket );
194
- $ phpcsFile ->fixer ->addContent ($ openBracket , str_repeat (' ' , ($ functionIndent + $ this ->indent )));
193
+ $ phpcsFile ->fixer ->addContent ($ openBracket , $ phpcsFile ->eolChar .str_repeat (' ' , ($ functionIndent + $ this ->indent )));
195
194
}
196
195
197
196
$ closeBracket = $ tokens [$ openBracket ]['parenthesis_closer ' ];
198
197
$ prev = $ phpcsFile ->findPrevious (T_WHITESPACE , ($ closeBracket - 1 ), null , true );
199
198
if ($ tokens [$ prev ]['line ' ] === $ tokens [$ closeBracket ]['line ' ]) {
200
199
$ error = 'Closing parenthesis of a multi-line function call must be on a line by itself ' ;
201
200
$ phpcsFile ->addError ($ error , $ closeBracket , 'CloseBracketLine ' );
202
- $ phpcsFile ->fixer ->addNewlineBefore ($ closeBracket );
203
- $ phpcsFile ->fixer ->addContentBefore ($ closeBracket , str_repeat (' ' , ($ functionIndent + $ this ->indent )));
201
+ $ phpcsFile ->fixer ->addContentBefore ($ closeBracket , $ phpcsFile ->eolChar .str_repeat (' ' , ($ functionIndent + $ this ->indent )));
204
202
}
205
203
206
204
// Each line between the parenthesis should be indented n spaces.
207
205
$ lastLine = $ tokens [$ openBracket ]['line ' ];
208
206
for ($ i = ($ openBracket + 1 ); $ i < $ closeBracket ; $ i ++) {
209
207
// Skip nested function calls.
210
- if ($ tokens [$ i ]['code ' ] === T_OPEN_PARENTHESIS ) {
208
+ if ($ tokens [$ i ]['code ' ] === T_OPEN_PARENTHESIS
209
+ && (isset ($ tokens [$ i ]['parenthesis_owner ' ]) === false
210
+ || $ tokens [$ tokens [$ i ]['parenthesis_owner ' ]]['code ' ] !== T_ARRAY )
211
+ ) {
212
+
211
213
$ i = $ tokens [$ i ]['parenthesis_closer ' ];
212
214
$ lastLine = $ tokens [$ i ]['line ' ];
213
215
continue ;
0 commit comments