Skip to content

Commit

Permalink
Fixed bug #2506 : PSR2 standard can't auto fix multi-line function ca…
Browse files Browse the repository at this point in the history
…ll inside a string concat statement
  • Loading branch information
gsherwood committed Oct 11, 2019
1 parent f797a35 commit c11b324
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
-- Boolean operators can now appear in the middle of the line
- PSR12.Files.FileHeader no longer ignores comments preceding a use, namespace, or declare statement
- PSR12.Files.FileHeader now allows a hashbang line at the top of the file
- Fixed bug #2506 : PSR2 standard can't auto fix multi-line function call inside a string concat statement
- Fixed bug #2530 : PEAR.Commenting.FunctionComment does not support intersection types in comments
- Fixed bug #2615 : Constant visibility false positive on non-class constants
- Fixed bug #2616 : PSR12.Files.FileHeader false positive when file only contains docblock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,9 @@ public function processMultiLineCall(File $phpcsFile, $stackPtr, $openBracket, $

$foundFunctionIndent = 0;
if ($first !== false) {
if ($tokens[$first]['code'] === T_INLINE_HTML) {
if ($tokens[$first]['code'] === T_INLINE_HTML
|| $tokens[$first]['code'] === T_CONSTANT_ENCAPSED_STRING
) {
$trimmed = ltrim($tokens[$first]['content']);
if ($trimmed === '') {
$foundFunctionIndent = strlen($tokens[$first]['content']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,3 +431,14 @@ $this->foo(
true

);

function m()
{
$t = '
' . (empty(true) ? '
' . f(
'1',
'2',
) . '
' : '');
}
Original file line number Diff line number Diff line change
Expand Up @@ -441,3 +441,14 @@ $this->foo(
['a','b'],
true
);

function m()
{
$t = '
' . (empty(true) ? '
' . f(
'1',
'2',
) . '
' : '');
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ public function getErrorList($testFile='FunctionCallSignatureUnitTest.inc')
424 => 1,
429 => 1,
432 => 1,
440 => 1,
441 => 1,
442 => 1,
];

}//end getErrorList()
Expand Down

0 comments on commit c11b324

Please sign in to comment.