Skip to content

Commit 5ba9401

Browse files
authored
Merge pull request #39 from Lassombria/fix-multiline-call-sniff
fix multiline call sniff
2 parents 697059a + fc12b0c commit 5ba9401

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ private function checkBeforeCall(File $phpcsFile, int $stackPtr): void
8383
T_OPEN_SHORT_ARRAY,
8484
T_COLON,
8585
T_ATTRIBUTE_END,
86+
T_RETURN
8687
];
8788

8889
if ($diffLines < 2 && !\in_array($prevToken['code'], $possiblePrevTokens, true)) {

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
$res = 23;
4+
35
$object
46
->child()
57
->method(\sprintf(
@@ -64,4 +66,12 @@ function some(\DOMDocument $dom): string
6466
])]
6567
function withAttributes()
6668
{
69+
$object = new \StdClass();
70+
71+
return $object
72+
->some([
73+
'bla' => 'bla',
74+
'foo' => 'foo',
75+
])
76+
->some2();
6777
}

0 commit comments

Comments
 (0)