Skip to content

Commit a24f6d4

Browse files
committed
Fixed indent check when function is called inside an array declaration (ref #2647)
1 parent da72d36 commit a24f6d4

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

src/Standards/PEAR/Sniffs/Functions/FunctionCallSignatureSniff.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ public function processMultiLineCall(File $phpcsFile, $stackPtr, $openBracket, $
349349
$foundFunctionIndent = 0;
350350
if ($first !== false) {
351351
if ($tokens[$first]['code'] === T_INLINE_HTML
352-
|| $tokens[$first]['code'] === T_CONSTANT_ENCAPSED_STRING
352+
|| ($tokens[$first]['code'] === T_CONSTANT_ENCAPSED_STRING
353+
&& $tokens[($first - 1)]['code'] === T_CONSTANT_ENCAPSED_STRING)
353354
) {
354355
$trimmed = ltrim($tokens[$first]['content']);
355356
if ($trimmed === '') {

src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc

+7
Original file line numberDiff line numberDiff line change
@@ -457,3 +457,10 @@ WHERE f IN(" . implode(
457457
) . ")";
458458
}
459459
}
460+
461+
$notices = array(
462+
'index' => sprintf(
463+
translation_function('a text string with %s placeholder'),
464+
'replacement'
465+
),
466+
);

src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.inc.fixed

+7
Original file line numberDiff line numberDiff line change
@@ -467,3 +467,10 @@ WHERE f IN(" . implode(
467467
) . ")";
468468
}
469469
}
470+
471+
$notices = array(
472+
'index' => sprintf(
473+
translation_function('a text string with %s placeholder'),
474+
'replacement'
475+
),
476+
);

src/Standards/PEAR/Tests/Functions/FunctionCallSignatureUnitTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public function getErrorList($testFile='FunctionCallSignatureUnitTest.inc')
122122
455 => 1,
123123
456 => 1,
124124
457 => 1,
125+
464 => 1,
125126
];
126127

127128
}//end getErrorList()

0 commit comments

Comments
 (0)