Skip to content

Commit

Permalink
Squiz.Functions.MultiLineFunctionDeclaration no longer reports errors…
Browse files Browse the repository at this point in the history
… for blank lines in a function declaration (ref #1369)
  • Loading branch information
gsherwood committed Feb 21, 2017
1 parent b7fdd3e commit 244d084
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public function processBracket(PHP_CodeSniffer_File $phpcsFile, $openBracket, $t
}

$next = $phpcsFile->findNext(T_WHITESPACE, ($i + 1), null, true);
if ($tokens[$next]['line'] !== ($tokens[$i]['line'] + 1)) {
if ($tokens[$next]['line'] === $tokens[$i]['line']) {
$error = 'Multi-line '.$type.' declarations must define one parameter per line';
$fix = $phpcsFile->addFixableError($error, $next, $errorPrefix.'OneParamPerLine');
if ($fix === true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,12 @@ function foo(
) {
// body
}

function foo(
$param1,

$param2,

$param3,
) : SomeClass {
}
2 changes: 2 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ http://pear.php.net/dtd/package-2.0.xsd">
<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.Functions.MultiLineFunctionDeclaration no longer reports errors for blank lines in a function declaration
-- It would previously report that only one argument is allowed per line
- 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 244d084

Please sign in to comment.