Skip to content

Commit c2eab04

Browse files
maryokukulich
authored andcommitted
SlevomatCodingStandard.Functions.RequireMultiLineCall: Fix reporting multiline call which exactly fits into line length limit
1 parent 9bad414 commit c2eab04

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

SlevomatCodingStandard/Sniffs/Functions/RequireMultiLineCallSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function process(File $phpcsFile, $stringPointer): void
107107
$lineEnd = $this->getLineEnd($phpcsFile, $parenthesisCloserPointer);
108108
$lineLength = strlen($lineStart . $call . $lineEnd);
109109
} else {
110-
$lineEnd = $this->getLineEnd($phpcsFile, $parenthesisOpenerPointer);
110+
$lineEnd = $this->getLineEnd($phpcsFile, $parenthesisOpenerPointer + 1);
111111
$lineLength = strlen($lineStart . $lineEnd);
112112
}
113113

tests/Sniffs/Functions/data/requireMultiLineCallNoErrors.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@ public function foo()
3434
$array = array_merge([], array_map(function (): string {
3535
return 'very looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong value';
3636
}, []));
37+
38+
$array = array_map(['a loooooooooooooooooong value that exactly fits into the line length limit'], function (): string {
39+
return 'foo';
40+
});

0 commit comments

Comments
 (0)