Skip to content

Commit f31f05d

Browse files
committed
Allow blank line after single line declaration #32
1 parent 9bf9f0c commit f31f05d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Inpsyde/Sniffs/CodeQuality/FunctionBodyStartSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private function checkBodyStart(
8686

8787
$error =
8888
($isMultiLineDeclare || $isSingleLineSignature) && $bodyLine !== ($openerLine + 2)
89-
|| $isSingleLineDeclare && $bodyLine !== ($openerLine + 1);
89+
|| $isSingleLineDeclare && $bodyLine > ($openerLine + 2);
9090

9191
if (!$error) {
9292
return [null, null, null];

tests/fixtures/function-body-start.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ function foo()
88
return 'foo';
99
}
1010

11-
// @phpcsWarningCodeOnNextLine WrongForSingleLineDeclaration
11+
// tolerate this as PHPStorm code styler cannot distinguish between
12+
// single line and multiline function declarations. See issue #32
1213
function bar()
1314
{
1415

@@ -66,7 +67,6 @@ public function foo()
6667
return 'foo';
6768
}
6869

69-
// @phpcsWarningCodeOnNextLine WrongForSingleLineDeclaration
7070
private function bar()
7171
{
7272

0 commit comments

Comments
 (0)