Skip to content

Commit

Permalink
Generic.WhiteSpace.ScopeIndent now supports static arrow functions (ref
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Nov 4, 2019
1 parent c8fca56 commit 033b431
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 5 deletions.
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
- File::getMethodProperties() now supports arrow functions
- Generic.CodeAnalysis.EmptyPhpStatement now reports unnecessary semicolons after control structure closing braces
-- Thanks to Vincent Langlet for the patch
- Generic.WhiteSpace.ScopeIndent now supports static arrow functions
- Fixed bug #2638 : Squiz.CSS.DuplicateClassDefinitionSniff sees comments as part of the class name
-- Thanks to Raphael Horber for the patch
- Fixed bug #2674 : Squiz.Functions.FunctionDeclarationArgumentSpacing prints wrong argument name in error message
Expand Down
3 changes: 2 additions & 1 deletion src/Standards/Generic/Sniffs/WhiteSpace/ScopeIndentSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,8 @@ public function process(File $phpcsFile, $stackPtr)
$next = $phpcsFile->findNext(Tokens::$emptyTokens, ($checkToken + 1), null, true);
if ($next === false
|| ($tokens[$next]['code'] !== T_CLOSURE
&& $tokens[$next]['code'] !== T_VARIABLE)
&& $tokens[$next]['code'] !== T_VARIABLE
&& $tokens[$next]['code'] !== T_FN)
) {
if ($this->debug === true) {
$line = $tokens[$checkToken]['line'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,11 @@ $query = Model::query()
static $b = '';
});

$result = array_map(
static fn(int $number) : int => $number + 1,
$numbers
);

?>

<?php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,11 @@ $query = Model::query()
static $b = '';
});

$result = array_map(
static fn(int $number) : int => $number + 1,
$numbers
);

?>

<?php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,11 @@ $query = Model::query()
static $b = '';
});

$result = array_map(
static fn(int $number) : int => $number + 1,
$numbers
);

?>

<?php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,11 @@ $query = Model::query()
static $b = '';
});

$result = array_map(
static fn(int $number) : int => $number + 1,
$numbers
);

?>

<?php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ public function getErrorList($testFile='ScopeIndentUnitTest.inc')
1340 => 1,
1342 => 1,
1345 => 1,
1440 => 1,
1441 => 1,
1442 => 1,
1443 => 1,
1445 => 1,
1446 => 1,
1447 => 1,
1448 => 1,
];

}//end getErrorList()
Expand Down

0 comments on commit 033b431

Please sign in to comment.