Skip to content

Commit

Permalink
PEAR.Functions.FunctionDeclaration no longer reports indent errors fo…
Browse files Browse the repository at this point in the history
…r blank lines in a function declaration (ref #1369)
  • Loading branch information
gsherwood committed Feb 21, 2017
1 parent ca8f28c commit b7fdd3e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ public function processMultiLineDeclaration(PHP_CodeSniffer_File $phpcsFile, $st
// We changed lines, so this should be a whitespace indent token.
if ($tokens[$i]['code'] !== T_WHITESPACE) {
$foundIndent = 0;
} else if ($tokens[$i]['line'] !== $tokens[($i + 1)]['line']) {
// This is an empty line, so don't check the indent.
$foundIndent = $expectedIndent;
} else {
$foundIndent = strlen($tokens[$i]['content']);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,12 @@ function foo(
): SomeClass // Comment here
{
}

function foo(
$param1,

$param2,

$param3,
) : SomeClass {
}
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,12 @@ function foo(
): SomeClass { // Comment here

}

function foo(
$param1,

$param2,

$param3,
) : SomeClass {
}
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
<license uri="https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt">BSD 3-Clause License</license>
<notes>
- The PHP-supplied T_COALESCE_EQUAL token has been replicated for PHP versions before 7.2
- PEAR.Functions.FunctionDeclaration no longer reports indent errors for blank lines in a function declaration
- Squiz.Commenting.FunctionComment now corrects multi-line param comment padding more accurately
- Squiz.Commenting.FunctionComment now properly fixes pipe-seperated param types
- Squiz.Commenting.FunctionComment now works correctly when function return types also contain a comment
Expand Down

0 comments on commit b7fdd3e

Please sign in to comment.