Skip to content

Commit b574727

Browse files
donatjkukulich
authored andcommitted
SlevomatCodingStandard.Functions.RequireTrailingCommaInCall: Skip instances on same line as closing parenthesis
1 parent 4c6eee4 commit b574727

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

SlevomatCodingStandard/Sniffs/Functions/RequireTrailingCommaInCallSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function process(File $phpcsFile, $parenthesisOpenerPointer): void
7979
return;
8080
}
8181

82-
if ($pointerBeforeParenthesisCloser + 1 === $parenthesisCloserPointer) {
82+
if ($tokens[$parenthesisCloserPointer]['line'] === $tokens[$pointerBeforeParenthesisCloser]['line']) {
8383
return;
8484
}
8585

tests/Sniffs/Functions/data/requireTrailingCommaInCallNoErrors.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,10 @@ public function __construct(
6464
doSomething([
6565
$a,
6666
]);
67+
68+
doSomething( $a,
69+
$b );
70+
71+
doSomething( doSomething(
72+
$foo,
73+
) );

0 commit comments

Comments
 (0)