@@ -292,29 +292,40 @@ public function processMultiLineCall(PHP_CodeSniffer_File $phpcsFile, $stackPtr,
292
292
// We need to work out how far indented the function
293
293
// call itself is, so we can work out how far to
294
294
// indent the arguments.
295
- for ($ i = ($ stackPtr - 1 ); $ i >= 0 ; $ i --) {
296
- if ($ tokens [$ i ]['line ' ] !== $ tokens [$ stackPtr ]['line ' ]) {
297
- $ i ++;
298
- break ;
295
+ $ start = $ phpcsFile ->findStartOfStatement ($ stackPtr );
296
+ foreach (array ('stackPtr ' , 'start ' ) as $ checkToken ) {
297
+ $ x = $ $ checkToken ;
298
+ for ($ i = ($ x - 1 ); $ i >= 0 ; $ i --) {
299
+ if ($ tokens [$ i ]['line ' ] !== $ tokens [$ x ]['line ' ]) {
300
+ $ i ++;
301
+ break ;
302
+ }
299
303
}
300
- }
301
304
302
- if ($ i <= 0 ) {
303
- $ functionIndent = 0 ;
304
- } else if ($ tokens [$ i ]['code ' ] === T_WHITESPACE ) {
305
- $ functionIndent = strlen ($ tokens [$ i ]['content ' ]);
306
- } else {
307
- $ trimmed = ltrim ($ tokens [$ i ]['content ' ]);
308
- if ($ trimmed === '' ) {
309
- if ($ tokens [$ i ]['code ' ] === T_INLINE_HTML ) {
310
- $ functionIndent = strlen ($ tokens [$ i ]['content ' ]);
305
+ if ($ i <= 0 ) {
306
+ $ functionIndent = 0 ;
307
+ } else if ($ tokens [$ i ]['code ' ] === T_WHITESPACE ) {
308
+ $ functionIndent = strlen ($ tokens [$ i ]['content ' ]);
309
+ } else if ($ tokens [$ i ]['code ' ] === T_CONSTANT_ENCAPSED_STRING ) {
310
+ $ functionIndent = 0 ;
311
+ } else {
312
+ $ trimmed = ltrim ($ tokens [$ i ]['content ' ]);
313
+ if ($ trimmed === '' ) {
314
+ if ($ tokens [$ i ]['code ' ] === T_INLINE_HTML ) {
315
+ $ functionIndent = strlen ($ tokens [$ i ]['content ' ]);
316
+ } else {
317
+ $ functionIndent = ($ tokens [$ i ]['column ' ] - 1 );
318
+ }
311
319
} else {
312
- $ functionIndent = ($ tokens [$ i ]['column ' ] - 1 );
320
+ $ functionIndent = (strlen ( $ tokens [$ i ]['content ' ]) - strlen ( $ trimmed ) );
313
321
}
314
- } else {
315
- $ functionIndent = (strlen ($ tokens [$ i ]['content ' ]) - strlen ($ trimmed ));
316
322
}
317
- }
323
+
324
+ $ varName = $ checkToken .'Indent ' ;
325
+ $ $ varName = $ functionIndent ;
326
+ }//end foreach
327
+
328
+ $ functionIndent = max ($ startIndent , $ stackPtrIndent );
318
329
319
330
$ next = $ phpcsFile ->findNext (PHP_CodeSniffer_Tokens::$ emptyTokens , ($ openBracket + 1 ), null , true );
320
331
if ($ tokens [$ next ]['line ' ] === $ tokens [$ openBracket ]['line ' ]) {
0 commit comments