Skip to content

Commit

Permalink
Merge branch 'hotfix/array-indices-fn-closure' of https://github.com/…
Browse files Browse the repository at this point in the history
  • Loading branch information
gsherwood committed Nov 19, 2019
2 parents 46674d3 + 98ae4ef commit 1a59388
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Sniffs/AbstractArraySniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public function process(File $phpcsFile, $stackPtr)
if ($tokens[$checkToken]['code'] === T_ARRAY
|| $tokens[$checkToken]['code'] === T_OPEN_SHORT_ARRAY
|| $tokens[$checkToken]['code'] === T_CLOSURE
|| $tokens[$checkToken]['code'] === T_FN
) {
// Let subsequent calls of this test handle nested arrays.
if ($tokens[$lastToken]['code'] !== T_DOUBLE_ARROW) {
Expand Down
2 changes: 2 additions & 0 deletions src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ $array = [
'hey' => $baz ??
['one'] ??
['two'],
'fn' =>
fn ($x) => yield 'k' => $x,
];

// phpcs:set Generic.Arrays.ArrayIndent indent 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ $array = [
'hey' => $baz ??
['one'] ??
['two'],
'fn' =>
fn ($x) => yield 'k' => $x,
];

// phpcs:set Generic.Arrays.ArrayIndent indent 2
Expand Down
4 changes: 2 additions & 2 deletions src/Standards/Generic/Tests/Arrays/ArrayIndentUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public function getErrorList()
31 => 1,
33 => 1,
41 => 1,
65 => 1,
66 => 1,
67 => 1,
68 => 1,
69 => 1,
70 => 1,
];

}//end getErrorList()
Expand Down

0 comments on commit 1a59388

Please sign in to comment.