Skip to content

Commit

Permalink
Fixed bug #20045 : Errors about indentation for closures with multi-l…
Browse files Browse the repository at this point in the history
…ine 'use' in functions
  • Loading branch information
gsherwood committed Aug 23, 2013
1 parent bc345e0 commit 12a1ec7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Expand Up @@ -250,7 +250,8 @@ public function processMultiLineDeclaration(PHP_CodeSniffer_File $phpcsFile, $st
if ($tokens[$i]['line'] !== $lastLine) {
if ($i === $tokens[$stackPtr]['parenthesis_closer']
|| ($tokens[$i]['code'] === T_WHITESPACE
&& ($i + 1) === $tokens[$stackPtr]['parenthesis_closer'])
&& (($i + 1) === $closeBracket
|| ($i + 1) === $tokens[$stackPtr]['parenthesis_closer']))
) {
// Closing braces need to be indented to the same level
// as the function.
Expand Down
Expand Up @@ -109,4 +109,19 @@ $longArgs_longVars = function (
$muchLongerVar3) {
// body
};

function test()
{
$longArgs_longVars = function (
$longArgument,
$longerArgument,
$muchLongerArgument
) use (
$longVar1,
$longerVar2,
$muchLongerVar3
) {
// body
};
}
?>
1 change: 1 addition & 0 deletions package.xml
Expand Up @@ -44,6 +44,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
-- Adds new error message for single-line arrays that end with a comma
- Fixed bug #20029 : ForbiddenFunction sniff incorrectly recognizes methods in USE clauses
- Fixed bug #20044 : PSR1 camelCase check does not ignore leading underscores
- Fixed bug #20045 : Errors about indentation for closures with multi-line 'use' in functions
</notes>
<contents>
<dir name="/">
Expand Down

0 comments on commit 12a1ec7

Please sign in to comment.