Skip to content

Commit 4d6ee42

Browse files
authored
Merge pull request #25 from Lassombria/fix-check-lines-before-multiline-call
fix check lines before multiline call
2 parents aee3725 + ffd1051 commit 4d6ee42

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

src/PhpCs/FiveLab/Sniffs/Formatting/WhiteSpaceAroundMultilineCallSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private function checkBeforeCall(File $phpcsFile, int $stackPtr): void
5959
$tokens = $phpcsFile->getTokens();
6060
$prevTokenPtr = $phpcsFile->findPrevious(Tokens::$emptyTokens, $stackPtr - 1, null, true);
6161

62-
$possiblePrevTokens = [T_OBJECT_OPERATOR, T_DOUBLE_COLON, T_COMMA];
62+
$possiblePrevTokens = [T_DOUBLE_COLON, T_COMMA];
6363

6464
if (false !== $prevTokenPtr && \in_array($tokens[$prevTokenPtr]['code'], $possiblePrevTokens, true)) {
6565
// Chain call.

tests/PhpCs/FiveLab/Sniffs/Formatting/Resources/white-space-around-multiline-call/wrong.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
function some(\DOMDocument $dom): void
44
{
5+
$cow = 33;
56
$dom->loadXML(
67
'<root/>'
78
);
@@ -13,4 +14,4 @@ function some(\DOMDocument $dom): void
1314
'Foo Bar Some %s',
1415
'foo'
1516
);
16-
$foo = 3;
17+
$foo = 3;

tests/PhpCs/FiveLab/Sniffs/Formatting/WhiteSpaceAroundMultilineCallSniffTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ public static function provideDataSet(): array
3232

3333
'wrong' => [
3434
__DIR__.'/Resources/white-space-around-multiline-call/wrong.php',
35+
[
36+
'message' => 'Must be one blank line before multiline call.',
37+
'source' => 'FiveLab.Formatting.WhiteSpaceAroundMultilineCall.MissedLineBefore',
38+
],
3539
[
3640
'message' => 'Must be one blank line after multiline call.',
3741
'source' => 'FiveLab.Formatting.WhiteSpaceAroundMultilineCall.MissedLineAfter',

0 commit comments

Comments
 (0)